@@ -250,6 +250,9 @@ |
||
250 | 250 | return $this->createAndCallController($class, $method, $params); |
251 | 251 | } |
252 | 252 | |
253 | + /** |
|
254 | + * @param string $hook |
|
255 | + */ |
|
253 | 256 | protected function callHook($hook) |
254 | 257 | { |
255 | 258 | if ($this->enableHooks) |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public function enableHooks() |
117 | 117 | { |
118 | 118 | $this->enableHooks = true; |
119 | - $this->hooks =& load_class('Hooks', 'core'); |
|
119 | + $this->hooks = & load_class('Hooks', 'core'); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | { |
163 | 163 | set_status_header($e->getCode()); |
164 | 164 | } |
165 | - $CI =& get_instance(); |
|
165 | + $CI = & get_instance(); |
|
166 | 166 | $CI->output->_status['redirect'] = $e->getMessage(); |
167 | 167 | } |
168 | 168 | // show_404() |
@@ -224,17 +224,17 @@ discard block |
||
224 | 224 | $this->setRawInputStream($request_params); |
225 | 225 | |
226 | 226 | // 404 checking |
227 | - if (! class_exists($class) || ! method_exists($class, $method)) |
|
227 | + if ( ! class_exists($class) || ! method_exists($class, $method)) |
|
228 | 228 | { |
229 | 229 | // If 404, CodeIgniter instance is not created yet. So create it here |
230 | 230 | // Because we need CI->output->_status to store info |
231 | - $CI =& get_instance(); |
|
231 | + $CI = & get_instance(); |
|
232 | 232 | if ($CI instanceof CIPHPUnitTestNullCodeIgniter) |
233 | 233 | { |
234 | 234 | CIPHPUnitTest::createCodeIgniterInstance(); |
235 | 235 | } |
236 | 236 | |
237 | - show_404($class.'::'.$method . '() is not found'); |
|
237 | + show_404($class.'::'.$method.'() is not found'); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | $params = $argv; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | { |
297 | 297 | if (is_string($string)) |
298 | 298 | { |
299 | - $INPUT =& load_class('Input', 'core'); |
|
299 | + $INPUT = & load_class('Input', 'core'); |
|
300 | 300 | CIPHPUnitTestReflection::setPrivateProperty( |
301 | 301 | $INPUT, |
302 | 302 | '_raw_input_stream', |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | new CI(); |
327 | 327 | } |
328 | 328 | $controller = new $class; |
329 | - $CI =& get_instance(); |
|
329 | + $CI = & get_instance(); |
|
330 | 330 | |
331 | 331 | // Set CodeIgniter instance to TestCase |
332 | 332 | $this->testCase->setCI($CI); |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function getStatus() |
374 | 374 | { |
375 | - $CI =& get_instance(); |
|
376 | - if (! isset($CI->output->_status)) |
|
375 | + $CI = & get_instance(); |
|
376 | + if ( ! isset($CI->output->_status)) |
|
377 | 377 | { |
378 | 378 | throw new LogicException('Status code is not set. You must call $this->request() first'); |
379 | 379 | } |
@@ -63,6 +63,9 @@ discard block |
||
63 | 63 | return self::$cache_dir; |
64 | 64 | } |
65 | 65 | |
66 | + /** |
|
67 | + * @param string $path |
|
68 | + */ |
|
66 | 69 | public static function getSrcCacheFilePath($path) |
67 | 70 | { |
68 | 71 | $len = strlen(self::$project_root); |
@@ -158,6 +161,9 @@ discard block |
||
158 | 161 | ); |
159 | 162 | } |
160 | 163 | |
164 | + /** |
|
165 | + * @param string $filename |
|
166 | + */ |
|
161 | 167 | protected static function writeTmpConfFile($filename, array $list) |
162 | 168 | { |
163 | 169 | $contents = implode("\n", $list); |
@@ -194,6 +200,9 @@ discard block |
||
194 | 200 | ); |
195 | 201 | } |
196 | 202 | |
203 | + /** |
|
204 | + * @param string $filename |
|
205 | + */ |
|
197 | 206 | protected static function getTmpConfFile($filename) |
198 | 207 | { |
199 | 208 | if (is_readable(self::$$filename)) |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | throw new LogicException("No such directory: $dir"); |
46 | 46 | } |
47 | 47 | |
48 | - self::$src_cache_dir = self::$cache_dir . '/src'; |
|
48 | + self::$src_cache_dir = self::$cache_dir.'/src'; |
|
49 | 49 | self::$tmp_function_whitelist_file = |
50 | - self::$cache_dir . '/conf/func_whiltelist.php'; |
|
50 | + self::$cache_dir.'/conf/func_whiltelist.php'; |
|
51 | 51 | self::$tmp_function_blacklist_file = |
52 | - self::$cache_dir . '/conf/func_blacklist.php'; |
|
52 | + self::$cache_dir.'/conf/func_blacklist.php'; |
|
53 | 53 | self::$tmp_patcher_list_file = |
54 | - self::$cache_dir . '/conf/patcher_list.php'; |
|
54 | + self::$cache_dir.'/conf/patcher_list.php'; |
|
55 | 55 | self::$tmp_include_paths_file = |
56 | - self::$cache_dir . '/conf/include_paths.php'; |
|
56 | + self::$cache_dir.'/conf/include_paths.php'; |
|
57 | 57 | self::$tmp_exclude_paths_file = |
58 | - self::$cache_dir . '/conf/exclude_paths.php'; |
|
58 | + self::$cache_dir.'/conf/exclude_paths.php'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public static function getCacheDir() |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
76 | - return self::$src_cache_dir . '/' . $relative_path; |
|
76 | + return self::$src_cache_dir.'/'.$relative_path; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | protected static function createDir($dir) |
80 | 80 | { |
81 | - if (! is_dir($dir)) |
|
81 | + if ( ! is_dir($dir)) |
|
82 | 82 | { |
83 | - if (! @mkdir($dir, 0777, true)) |
|
83 | + if ( ! @mkdir($dir, 0777, true)) |
|
84 | 84 | { |
85 | - throw new RuntimeException('Failed to create folder: ' . $dir); |
|
85 | + throw new RuntimeException('Failed to create folder: '.$dir); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | public static function appendTmpFunctionBlacklist($function) |
155 | 155 | { |
156 | 156 | file_put_contents( |
157 | - self::getTmpFunctionBlacklistFile(), $function . "\n", FILE_APPEND |
|
157 | + self::getTmpFunctionBlacklistFile(), $function."\n", FILE_APPEND |
|
158 | 158 | ); |
159 | 159 | } |
160 | 160 | |
@@ -234,20 +234,20 @@ discard block |
||
234 | 234 | { |
235 | 235 | $cache = self::getSrcCacheFilePath($orig_file); |
236 | 236 | @unlink($cache); |
237 | - MonkeyPatchManager::log('remove_src_cache: ' . $cache); |
|
237 | + MonkeyPatchManager::log('remove_src_cache: '.$cache); |
|
238 | 238 | return $cache; |
239 | 239 | } |
240 | 240 | |
241 | 241 | public static function clearSrcCache() |
242 | 242 | { |
243 | 243 | self::recursiveUnlink(self::$src_cache_dir); |
244 | - MonkeyPatchManager::log('clear_src_cache: cleared ' . self::$src_cache_dir); |
|
244 | + MonkeyPatchManager::log('clear_src_cache: cleared '.self::$src_cache_dir); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | public static function clearCache() |
248 | 248 | { |
249 | 249 | self::recursiveUnlink(self::$cache_dir); |
250 | - MonkeyPatchManager::log('clear_cache: cleared ' . self::$cache_dir); |
|
250 | + MonkeyPatchManager::log('clear_cache: cleared '.self::$cache_dir); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | protected static function recursiveUnlink($dir) |
259 | 259 | { |
260 | - if (! is_dir($dir)) |
|
260 | + if ( ! is_dir($dir)) |
|
261 | 261 | { |
262 | 262 | return; |
263 | 263 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param string $function function name |
23 | 23 | * @param mixed $return_value return value |
24 | - * @param string $class_name class::method to apply this patch |
|
24 | + * @param string $class_method class::method to apply this patch |
|
25 | 25 | */ |
26 | 26 | public static function patchFunction($function, $return_value, $class_method = null) |
27 | 27 | { |
@@ -55,6 +55,9 @@ discard block |
||
55 | 55 | PatchManager::clear(); |
56 | 56 | } |
57 | 57 | |
58 | + /** |
|
59 | + * @param string $class_method |
|
60 | + */ |
|
58 | 61 | protected static function getClassname($class_method) |
59 | 62 | { |
60 | 63 | if (strpos($class_method, '::') === false) |
@@ -136,6 +136,11 @@ discard block |
||
136 | 136 | return $_is_loaded; |
137 | 137 | } |
138 | 138 | |
139 | +/** |
|
140 | + * @param boolean $return |
|
141 | + * |
|
142 | + * @return boolean |
|
143 | + */ |
|
139 | 144 | function is_cli($return = null) |
140 | 145 | { |
141 | 146 | static $_return = TRUE; |
@@ -148,6 +153,9 @@ discard block |
||
148 | 153 | return $_return; |
149 | 154 | } |
150 | 155 | |
156 | +/** |
|
157 | + * @param string $message |
|
158 | + */ |
|
151 | 159 | function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') |
152 | 160 | { |
153 | 161 | $status_code = abs($status_code); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | |
264 | 264 | // Save status code in Output object |
265 | 265 | // added by ci-phpunit-test |
266 | - $CI =& get_instance(); |
|
266 | + $CI = & get_instance(); |
|
267 | 267 | $output = $CI->output; |
268 | 268 | $output->_status = [ |
269 | 269 | 'code' => $code, |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | if (empty($_config)) |
377 | 377 | { |
378 | 378 | // references cannot be directly assigned to static variables, so we use an array |
379 | - $_config[0] =& get_config(); |
|
379 | + $_config[0] = & get_config(); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | return isset($_config[0][$item]) ? $_config[0][$item] : NULL; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | if (in_array($class, $this->alias)) |
71 | 71 | { |
72 | - $dir = __DIR__ . '/alias'; |
|
72 | + $dir = __DIR__.'/alias'; |
|
73 | 73 | $this->loadClassFile($dir, $class); |
74 | 74 | } |
75 | 75 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | else |
90 | 90 | { |
91 | - $dir = __DIR__ . '/exceptions'; |
|
91 | + $dir = __DIR__.'/exceptions'; |
|
92 | 92 | $this->loadClassFile($dir, $class); |
93 | 93 | } |
94 | 94 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | protected function loadClassFile($dir, $class) |
131 | 131 | { |
132 | - $class_file = $dir . '/' . $class . '.php'; |
|
132 | + $class_file = $dir.'/'.$class.'.php'; |
|
133 | 133 | if (file_exists($class_file)) |
134 | 134 | { |
135 | 135 | require $class_file; |
@@ -86,7 +86,7 @@ |
||
86 | 86 | break; |
87 | 87 | default: |
88 | 88 | throw new RuntimeException( |
89 | - 'Sorry, ' . $count . ' params not implemented yet' |
|
89 | + 'Sorry, '.$count.' params not implemented yet' |
|
90 | 90 | ); |
91 | 91 | } |
92 | 92 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param string $classname |
34 | 34 | * @param array $params [method_name => return_value] |
35 | - * @param mixed $constructor_params false: disable construntor, array: construntor params |
|
35 | + * @param boolean $constructor_params false: disable construntor, array: construntor params |
|
36 | 36 | * |
37 | 37 | * @return object PHPUnit mock object |
38 | 38 | */ |
@@ -72,6 +72,10 @@ discard block |
||
72 | 72 | return $mock; |
73 | 73 | } |
74 | 74 | |
75 | + /** |
|
76 | + * @param string $method |
|
77 | + * @param string $with |
|
78 | + */ |
|
75 | 79 | protected function _verify($mock, $method, $params = null, $expects, $with) |
76 | 80 | { |
77 | 81 | $invocation = $mock->expects($expects) |
@@ -24,18 +24,18 @@ |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | $dir = dirname($this->file); |
27 | - if (! is_dir($dir)) |
|
27 | + if ( ! is_dir($dir)) |
|
28 | 28 | { |
29 | 29 | if (@mkdir($dir, 0777, true) === false) |
30 | 30 | { |
31 | - throw new RuntimeException('Failed to create folder: ' . $dir); |
|
31 | + throw new RuntimeException('Failed to create folder: '.$dir); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | 35 | if (file_put_contents($this->file, '') === false) |
36 | 36 | { |
37 | 37 | throw new RuntimeException( |
38 | - 'Failed to write to cache file: ' . $this->file |
|
38 | + 'Failed to write to cache file: '.$this->file |
|
39 | 39 | ); |
40 | 40 | } |
41 | 41 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | $ref_method->setAccessible(true); |
22 | 22 | $obj = (gettype($obj) === 'object') ? $obj : null; |
23 | 23 | |
24 | - return function () use ($obj, $ref_method) { |
|
24 | + return function() use ($obj, $ref_method) { |
|
25 | 25 | $args = func_get_args(); |
26 | 26 | return $ref_method->invokeArgs($obj, $args); |
27 | 27 | }; |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Autoloader for ci-phpunit-test |
12 | -require __DIR__ . '/CIPHPUnitTestAutoloader.php'; |
|
13 | -require __DIR__ . '/CIPHPUnitTestFileCache.php'; |
|
12 | +require __DIR__.'/CIPHPUnitTestAutoloader.php'; |
|
13 | +require __DIR__.'/CIPHPUnitTestFileCache.php'; |
|
14 | 14 | $cache = new CIPHPUnitTestFileCache( |
15 | - __DIR__ . '/tmp/cache/autoload.php' |
|
15 | + __DIR__.'/tmp/cache/autoload.php' |
|
16 | 16 | ); |
17 | 17 | $autoload_dirs = CIPHPUnitTest::getAutoloadDirs(); |
18 | 18 | $autoloader = new CIPHPUnitTestAutoloader($cache, $autoload_dirs); |
@@ -20,5 +20,5 @@ discard block |
||
20 | 20 | |
21 | 21 | // Register CodeIgniter's tests/mocks/autoloader.php |
22 | 22 | define('SYSTEM_PATH', BASEPATH); |
23 | -require APPPATH .'tests/mocks/autoloader.php'; |
|
23 | +require APPPATH.'tests/mocks/autoloader.php'; |
|
24 | 24 | spl_autoload_register('autoload'); |