+
+ // Trace message
+ //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
+ }
+
+ /**
+ * Tests method BootstrapFramework::isReachableFilePath() with a
+ * non-existing path. $isReachable should always return TRUE as nothing is
+ * restricting PHP.
+ */
+ public function testBootstrapIsReachableFilePathUnrestrictedNotExisting () {
+ // Init SPL file info instance
+ //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
+ $infoInstance = new SplFileInfo('/does/not/exist/');
+
+ // Invoke method
+ /* NOISY-DEBUG: */ printf('[%s:%d]: infoInstance=%s' . PHP_EOL, __METHOD__, __LINE__, get_class($infoInstance));
+ $isReachable = FrameworkBootstrap::isReachableFilePath($infoInstance);
+
+ // Test if it is not reachable
+ /* NOISY-DEBUG: */ printf('[%s:%d]: isReachable=%d' . PHP_EOL, __METHOD__, __LINE__, intval($isReachable));
+ $this->assertTrue($isReachable, 'Returned true on a non-existing path');
+
+ // Trace message
+ //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
+ }
+
+ /**
+ * Tests method BootstrapFramework::isReachableFilePath() with a
+ * non-existing path. $isReachable should be FALSE here as it is always
+ * outside the scope of open_basedir.
+ */
+ public function testBootstrapIsReachableFilePathRestrictedNotExisting () {
+ // Init SPL file info instance
+ //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
+ $infoInstance = new SplFileInfo('/does/not/exist/');
+
+ // "Detect" root path
+ //* NOISY-DEBUG: */ printf('[%s:%d]: infoInstance=%s' . PHP_EOL, __METHOD__, __LINE__, get_class($infoInstance));
+ $rootScriptPath = realpath(dirname(dirname(FrameworkBootstrap::detectScriptPath())));
+
+ // Set it
+ /* NOISY-DEBUG: */ printf('[%s:%d]: open_basedir=%s,rootScriptPath[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, ini_get('open_basedir'), gettype($rootScriptPath), $rootScriptPath);
+ $result = ini_set('open_basedir', $rootScriptPath . ':/etc/');
+
+ // Was it set?
+ //* NOISY-DEBUG: */ printf('[%s:%d]: result[]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($result));
+ if ($result === FALSE) {
+ // Didn't work
+ $this->failed(sprintf('Cannot set open_basepath=%s', $rootScriptPath));
+ }
+
+ // Invoke method
+ //* NOISY-DEBUG: */ printf('[%s:%d]: Testing method FrameworkBootstrap::isReachableFilePath(%s) ...' . PHP_EOL, __METHOD__, __LINE__, get_class($infoInstance));
+ $isReachable = FrameworkBootstrap::isReachableFilePath($infoInstance);
+
+ // Test if
+ //* NOISY-DEBUG: */ printf('[%s:%d]: isReachable=%d - Testing method ...' . PHP_EOL, __METHOD__, __LINE__, intval($isReachable));
+ $this->assertTrue(!$isReachable, 'Returned true on a non-existing path');
+
+ // Trace message
+ //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
+ }
+
+ /**
+ * Tests method BootstrapFramework::isReachableFilePath() with an
+ * existing path. $isReachable should be TRUE here as it is within the scope
+ * of open_basedir.
+ */
+ public function testBootstrapIsReachableFilePathRestrictedExisting () {
+ // Init SPL file info instance
+ //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
+ $infoInstance = new SplFileInfo(__DIR__);
+
+ // "Detect" root path
+ //* NOISY-DEBUG: */ printf('[%s:%d]: infoInstance=%s' . PHP_EOL, __METHOD__, __LINE__, get_class($infoInstance));
+ $rootScriptPath = realpath(dirname(dirname(FrameworkBootstrap::detectScriptPath())));
+
+ // Set it
+ //* NOISY-DEBUG: */ printf('[%s:%d]: rootScriptPath[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($rootScriptPath), $rootScriptPath);
+ $result = ini_set('open_basedir', $rootScriptPath . ':/etc/');
+
+ // Was it set?
+ //* NOISY-DEBUG: */ printf('[%s:%d]: result[]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($result));
+ if ($result === FALSE) {
+ // Didn't work
+ $this->failed(sprintf('Cannot set open_basepath=%s', $rootScriptPath));
+ }
+
+ // Invoke method
+ //* NOISY-DEBUG: */ printf('[%s:%d]: Testing method FrameworkBootstrap::isReachableFilePath(%s) ...' . PHP_EOL, __METHOD__, __LINE__, get_class($infoInstance));
+ $isReachable = FrameworkBootstrap::isReachableFilePath($infoInstance);
+
+ // Test if
+ //* NOISY-DEBUG: */ printf('[%s:%d]: isReachable=%d - Testing method ...' . PHP_EOL, __METHOD__, __LINE__, intval($isReachable));
+ $this->assertTrue($isReachable, 'Returned true on a non-existing path');
+
+ // Trace message
+ //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);