public static function setPatcherCacheDir($dir = null) { if ($dir === null) { $dir = APPPATH . 'tests/_ci_phpunit_test/tmp/cache'; } MonkeyPatchManager::setCacheDir($dir); }
protected function tearDown() { if (class_exists('MonkeyPatch', false)) { if (MonkeyPatchManager::isEnabled('FunctionPatcher')) { try { MonkeyPatch::verifyFunctionInvocations(); } catch (Exception $e) { MonkeyPatch::resetFunctions(); throw $e; } MonkeyPatch::resetFunctions(); } if (MonkeyPatchManager::isEnabled('ConstantPatcher')) { MonkeyPatch::resetConstants(); } if (MonkeyPatchManager::isEnabled('MethodPatcher')) { try { MonkeyPatch::verifyMethodInvocations(); } catch (Exception $e) { MonkeyPatch::resetMethods(); throw $e; } MonkeyPatch::resetMethods(); } } }
public function stream_open($path, $mode, $options, &$openedPath) { $this->unwrap(); MonkeyPatchManager::log('stream_open: ' . $path); $including = (bool) ($options & self::STREAM_OPEN_FOR_INCLUDE); if ($including && $this->shouldPreprocess($path)) { $this->resource = $this->preprocessAndOpen($path); $this->wrap(); return true; } if (isset($this->context)) { $this->resource = fopen($path, $mode, $options, $this->context); } else { $this->resource = fopen($path, $mode, $options); } $this->wrap(); return $this->resource !== false; }
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: ' . SELF; exit(3); // EXIT_CONFIG } else { $view_folder = APPPATH . 'views'; } } if (($_temp = realpath($view_folder)) !== FALSE) { $view_folder = $_temp . DIRECTORY_SEPARATOR; } else { $view_folder = rtrim($view_folder, '/\\') . DIRECTORY_SEPARATOR; } define('VIEWPATH', $view_folder); /* * ------------------------------------------------------------------- * Enabling Monkey Patching * ------------------------------------------------------------------- * * If you want to use monkey patching, uncomment below code and configure * for your application. */ require __DIR__ . '/_ci_phpunit_test/patcher/bootstrap.php'; MonkeyPatchManager::init(['cache_dir' => APPPATH . 'tests/_ci_phpunit_test/tmp/cache', 'include_paths' => [APPPATH, BASEPATH], 'exclude_paths' => [APPPATH . 'tests/'], 'patcher_list' => ['ExitPatcher', 'FunctionPatcher', 'MethodPatcher'], 'functions_to_patch' => [], 'exit_exception_classname' => 'CIPHPUnitTestExitException']); /* * ------------------------------------------------------------------- * Added for CI PHPUnit Test * ------------------------------------------------------------------- */ require __DIR__ . '/_ci_phpunit_test/CIPHPUnitTest.php'; CIPHPUnitTest::init();
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: ' . SELF; exit(3); // EXIT_CONFIG } define('VIEWPATH', $view_folder . DIRECTORY_SEPARATOR); /* * ------------------------------------------------------------------- * Enabling Monkey Patching * ------------------------------------------------------------------- * * If you want to use monkey patching, uncomment below code and configure * for your application. */ require __DIR__ . '/_ci_phpunit_test/patcher/bootstrap.php'; MonkeyPatchManager::init(['php_parser' => 'PREFER_PHP5', 'cache_dir' => APPPATH . 'tests/_ci_phpunit_test/tmp/cache', 'include_paths' => [APPPATH, BASEPATH, APPPATH . 'tests/_ci_phpunit_test/replacing/'], 'exclude_paths' => [APPPATH . 'tests/', '-' . APPPATH . 'tests/_ci_phpunit_test/replacing/'], 'patcher_list' => ['ExitPatcher', 'FunctionPatcher', 'MethodPatcher', 'ConstantPatcher'], 'functions_to_patch' => [], 'exit_exception_classname' => 'CIPHPUnitTestExitException']); /* * ------------------------------------------------------------------- * Added for ci-phpunit-test * ------------------------------------------------------------------- */ require __DIR__ . '/_ci_phpunit_test/CIPHPUnitTest.php'; CIPHPUnitTest::init(); /* * Or you can set directories for autoloading */ /* CIPHPUnitTest::init([ // Directories for autoloading APPPATH.'models', APPPATH.'libraries',