@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Part of ci-phpunit-test |
|
4 | - * |
|
5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | - * @license MIT License |
|
7 | - * @copyright 2015 Kenji Suzuki |
|
8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | - */ |
|
3 | + * Part of ci-phpunit-test |
|
4 | + * |
|
5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | + * @license MIT License |
|
7 | + * @copyright 2015 Kenji Suzuki |
|
8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | class CategorySeeder extends Seeder { |
12 | 12 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | return $this->$name; |
42 | 42 | } |
43 | 43 | |
44 | - throw new LogicException('No such property: ' . $name); |
|
44 | + throw new LogicException('No such property: '.$name); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public static function setUpBeforeClass() |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | reset_instance(); |
63 | 63 | CIPHPUnitTest::createCodeIgniterInstance(); |
64 | - $this->CI =& get_instance(); |
|
64 | + $this->CI = & get_instance(); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | protected function tearDown() |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $this->assertSame( |
237 | 237 | $code, |
238 | 238 | $actual, |
239 | - 'Status code is not ' . $code . ' but ' . $actual . '.' |
|
239 | + 'Status code is not '.$code.' but '.$actual.'.' |
|
240 | 240 | ); |
241 | 241 | } |
242 | 242 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function assertResponseHeader($name, $value) |
250 | 250 | { |
251 | - $CI =& get_instance(); |
|
251 | + $CI = & get_instance(); |
|
252 | 252 | $actual = $CI->output->get_header($name); |
253 | 253 | |
254 | 254 | if ($actual === null) |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function assertResponseCookie($name, $value, $allow_duplicate = false) |
274 | 274 | { |
275 | - $CI =& get_instance(); |
|
275 | + $CI = & get_instance(); |
|
276 | 276 | $cookies = isset($CI->output->_cookies[$name]) |
277 | 277 | ? $CI->output->_cookies[$name] : null; |
278 | 278 | |
@@ -330,23 +330,23 @@ discard block |
||
330 | 330 | $this->fail('redirect() is not called.'); |
331 | 331 | } |
332 | 332 | |
333 | - if (! function_exists('site_url')) |
|
333 | + if ( ! function_exists('site_url')) |
|
334 | 334 | { |
335 | - $CI =& get_instance(); |
|
335 | + $CI = & get_instance(); |
|
336 | 336 | $CI->load->helper('url'); |
337 | 337 | } |
338 | 338 | |
339 | - if (! preg_match('#^(\w+:)?//#i', $uri)) |
|
339 | + if ( ! preg_match('#^(\w+:)?//#i', $uri)) |
|
340 | 340 | { |
341 | 341 | $uri = site_url($uri); |
342 | 342 | } |
343 | 343 | $absolute_url = $uri; |
344 | - $expected = 'Redirect to ' . $absolute_url; |
|
344 | + $expected = 'Redirect to '.$absolute_url; |
|
345 | 345 | |
346 | 346 | $this->assertSame( |
347 | 347 | $expected, |
348 | 348 | $status['redirect'], |
349 | - 'URL to redirect is not ' . $expected . ' but ' . $status['redirect'] . '.' |
|
349 | + 'URL to redirect is not '.$expected.' but '.$status['redirect'].'.' |
|
350 | 350 | ); |
351 | 351 | |
352 | 352 | if ($code !== null) |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $this->assertSame( |
355 | 355 | $code, |
356 | 356 | $status['code'], |
357 | - 'Status code is not ' . $code . ' but ' . $status['code'] . '.' |
|
357 | + 'Status code is not '.$code.' but '.$status['code'].'.' |
|
358 | 358 | ); |
359 | 359 | } |
360 | 360 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Part of ci-phpunit-test |
|
4 | - * |
|
5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | - * @license MIT License |
|
7 | - * @copyright 2015 Kenji Suzuki |
|
8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | - */ |
|
3 | + * Part of ci-phpunit-test |
|
4 | + * |
|
5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | + * @license MIT License |
|
7 | + * @copyright 2015 Kenji Suzuki |
|
8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | class CategorySeeder extends Seeder { |
12 | 12 |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Part of ci-phpunit-test |
|
4 | - * |
|
5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | - * @license MIT License |
|
7 | - * @copyright 2015 Kenji Suzuki |
|
8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | - */ |
|
3 | + * Part of ci-phpunit-test |
|
4 | + * |
|
5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | + * @license MIT License |
|
7 | + * @copyright 2015 Kenji Suzuki |
|
8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | class CategorySeeder extends Seeder { |
12 | 12 |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Part of ci-phpunit-test |
|
4 | - * |
|
5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | - * @license MIT License |
|
7 | - * @copyright 2015 Kenji Suzuki |
|
8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | - */ |
|
3 | + * Part of ci-phpunit-test |
|
4 | + * |
|
5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | + * @license MIT License |
|
7 | + * @copyright 2015 Kenji Suzuki |
|
8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | class CategorySeeder extends Seeder { |
12 | 12 |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | public static function install($app = 'application') |
16 | 16 | { |
17 | 17 | self::recursiveCopy( |
18 | - dirname(__FILE__) . '/application/tests', |
|
19 | - $app . '/' . static::TEST_FOLDER |
|
18 | + dirname(__FILE__).'/application/tests', |
|
19 | + $app.'/'.static::TEST_FOLDER |
|
20 | 20 | ); |
21 | 21 | self::fixPath($app); |
22 | 22 | } |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | */ |
27 | 27 | private static function fixPath($app = 'application') |
28 | 28 | { |
29 | - $file = $app . '/' . static::TEST_FOLDER . '/Bootstrap.php'; |
|
29 | + $file = $app.'/'.static::TEST_FOLDER.'/Bootstrap.php'; |
|
30 | 30 | $contents = file_get_contents($file); |
31 | 31 | |
32 | - if (! file_exists('system')) { |
|
32 | + if ( ! file_exists('system')) { |
|
33 | 33 | if (file_exists('vendor/codeigniter/framework/system')) { |
34 | 34 | $contents = str_replace( |
35 | 35 | '$system_path = \'../../system\';', |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | - if (! file_exists('index.php')) { |
|
44 | + if ( ! file_exists('index.php')) { |
|
45 | 45 | if (file_exists('public/index.php')) { |
46 | 46 | $contents = str_replace( |
47 | 47 | "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
48 | 48 | "define('FCPATH', realpath(dirname(__FILE__).'/../../public').'/');", |
49 | 49 | $contents |
50 | 50 | ); |
51 | - } elseif (file_exists($app . '/public/index.php')) { |
|
51 | + } elseif (file_exists($app.'/public/index.php')) { |
|
52 | 52 | $contents = str_replace( |
53 | 53 | "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
54 | 54 | "define('FCPATH', realpath(dirname(__FILE__).'/../public').'/');", |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | |
72 | 72 | public static function update($app = 'application') |
73 | 73 | { |
74 | - $target_dir = $app . '/' . static::TEST_FOLDER . '/_ci_phpunit_test'; |
|
74 | + $target_dir = $app.'/'.static::TEST_FOLDER.'/_ci_phpunit_test'; |
|
75 | 75 | self::recursiveUnlink($target_dir); |
76 | 76 | self::recursiveCopy( |
77 | - dirname(__FILE__) . '/application/tests/_ci_phpunit_test', |
|
77 | + dirname(__FILE__).'/application/tests/_ci_phpunit_test', |
|
78 | 78 | $target_dir |
79 | 79 | ); |
80 | 80 | } |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | |
97 | 97 | foreach ($iterator as $file) { |
98 | 98 | if ($file->isDir()) { |
99 | - @mkdir($dst . '/' . $iterator->getSubPathName()); |
|
99 | + @mkdir($dst.'/'.$iterator->getSubPathName()); |
|
100 | 100 | } else { |
101 | - $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
|
101 | + $success = copy($file, $dst.'/'.$iterator->getSubPathName()); |
|
102 | 102 | if ($success) { |
103 | - echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
|
103 | + echo 'copied: '.$dst.'/'.$iterator->getSubPathName().PHP_EOL; |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
@@ -1,145 +1,145 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Part of ci-phpunit-test |
|
4 | - * |
|
5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | - * @license MIT License |
|
7 | - * @copyright 2015 Kenji Suzuki |
|
8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | - */ |
|
3 | + * Part of ci-phpunit-test |
|
4 | + * |
|
5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | + * @license MIT License |
|
7 | + * @copyright 2015 Kenji Suzuki |
|
8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | class Installer |
12 | 12 | { |
13 | - const TEST_FOLDER = 'tests'; |
|
13 | + const TEST_FOLDER = 'tests'; |
|
14 | 14 | |
15 | - public static function install($app = 'application') |
|
16 | - { |
|
17 | - self::recursiveCopy( |
|
18 | - dirname(__FILE__) . '/application/tests', |
|
19 | - $app . '/' . static::TEST_FOLDER |
|
20 | - ); |
|
21 | - self::fixPath($app); |
|
22 | - } |
|
15 | + public static function install($app = 'application') |
|
16 | + { |
|
17 | + self::recursiveCopy( |
|
18 | + dirname(__FILE__) . '/application/tests', |
|
19 | + $app . '/' . static::TEST_FOLDER |
|
20 | + ); |
|
21 | + self::fixPath($app); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * Fix paths in Bootstrap.php |
|
26 | - */ |
|
27 | - private static function fixPath($app = 'application') |
|
28 | - { |
|
29 | - $file = $app . '/' . static::TEST_FOLDER . '/Bootstrap.php'; |
|
30 | - $contents = file_get_contents($file); |
|
24 | + /** |
|
25 | + * Fix paths in Bootstrap.php |
|
26 | + */ |
|
27 | + private static function fixPath($app = 'application') |
|
28 | + { |
|
29 | + $file = $app . '/' . static::TEST_FOLDER . '/Bootstrap.php'; |
|
30 | + $contents = file_get_contents($file); |
|
31 | 31 | |
32 | - if (! file_exists('system')) { |
|
33 | - if (file_exists('vendor/codeigniter/framework/system')) { |
|
34 | - $contents = str_replace( |
|
35 | - '$system_path = \'../../system\';', |
|
36 | - '$system_path = \'../../vendor/codeigniter/framework/system\';', |
|
37 | - $contents |
|
38 | - ); |
|
39 | - } else { |
|
40 | - throw new Exception('Can\'t find "system" folder.'); |
|
41 | - } |
|
42 | - } |
|
32 | + if (! file_exists('system')) { |
|
33 | + if (file_exists('vendor/codeigniter/framework/system')) { |
|
34 | + $contents = str_replace( |
|
35 | + '$system_path = \'../../system\';', |
|
36 | + '$system_path = \'../../vendor/codeigniter/framework/system\';', |
|
37 | + $contents |
|
38 | + ); |
|
39 | + } else { |
|
40 | + throw new Exception('Can\'t find "system" folder.'); |
|
41 | + } |
|
42 | + } |
|
43 | 43 | |
44 | - if (! file_exists('index.php')) { |
|
45 | - if (file_exists('public/index.php')) { |
|
46 | - // CodeIgniter 3.0.6 and after |
|
47 | - $contents = str_replace( |
|
48 | - "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);", |
|
49 | - "define('FCPATH', realpath(dirname(__FILE__).'/../../public').DIRECTORY_SEPARATOR);", |
|
50 | - $contents |
|
51 | - ); |
|
52 | - // CodeIgniter 3.0.5 and before |
|
53 | - $contents = str_replace( |
|
54 | - "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
55 | - "define('FCPATH', realpath(dirname(__FILE__).'/../../public').'/');", |
|
56 | - $contents |
|
57 | - ); |
|
58 | - } elseif (file_exists($app . '/public/index.php')) { |
|
59 | - // CodeIgniter 3.0.6 and after |
|
60 | - $contents = str_replace( |
|
61 | - "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);", |
|
62 | - "define('FCPATH', realpath(dirname(__FILE__).'/../public').DIRECTORY_SEPARATOR);", |
|
63 | - $contents |
|
64 | - ); |
|
65 | - // CodeIgniter 3.0.5 and before |
|
66 | - $contents = str_replace( |
|
67 | - "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
68 | - "define('FCPATH', realpath(dirname(__FILE__).'/../public').'/');", |
|
69 | - $contents |
|
70 | - ); |
|
71 | - if ($app != 'application') { |
|
72 | - $contents = str_replace( |
|
73 | - "\$application_folder = '../../application';", |
|
74 | - "\$application_folder = '../../{$app}';", |
|
75 | - $contents |
|
76 | - ); |
|
77 | - } |
|
78 | - } else { |
|
79 | - throw new Exception('Can\'t find "index.php".'); |
|
80 | - } |
|
81 | - } |
|
44 | + if (! file_exists('index.php')) { |
|
45 | + if (file_exists('public/index.php')) { |
|
46 | + // CodeIgniter 3.0.6 and after |
|
47 | + $contents = str_replace( |
|
48 | + "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);", |
|
49 | + "define('FCPATH', realpath(dirname(__FILE__).'/../../public').DIRECTORY_SEPARATOR);", |
|
50 | + $contents |
|
51 | + ); |
|
52 | + // CodeIgniter 3.0.5 and before |
|
53 | + $contents = str_replace( |
|
54 | + "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
55 | + "define('FCPATH', realpath(dirname(__FILE__).'/../../public').'/');", |
|
56 | + $contents |
|
57 | + ); |
|
58 | + } elseif (file_exists($app . '/public/index.php')) { |
|
59 | + // CodeIgniter 3.0.6 and after |
|
60 | + $contents = str_replace( |
|
61 | + "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);", |
|
62 | + "define('FCPATH', realpath(dirname(__FILE__).'/../public').DIRECTORY_SEPARATOR);", |
|
63 | + $contents |
|
64 | + ); |
|
65 | + // CodeIgniter 3.0.5 and before |
|
66 | + $contents = str_replace( |
|
67 | + "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
68 | + "define('FCPATH', realpath(dirname(__FILE__).'/../public').'/');", |
|
69 | + $contents |
|
70 | + ); |
|
71 | + if ($app != 'application') { |
|
72 | + $contents = str_replace( |
|
73 | + "\$application_folder = '../../application';", |
|
74 | + "\$application_folder = '../../{$app}';", |
|
75 | + $contents |
|
76 | + ); |
|
77 | + } |
|
78 | + } else { |
|
79 | + throw new Exception('Can\'t find "index.php".'); |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | - file_put_contents($file, $contents); |
|
84 | - } |
|
83 | + file_put_contents($file, $contents); |
|
84 | + } |
|
85 | 85 | |
86 | - public static function update($app = 'application') |
|
87 | - { |
|
88 | - $target_dir = $app . '/' . static::TEST_FOLDER . '/_ci_phpunit_test'; |
|
89 | - self::recursiveUnlink($target_dir); |
|
90 | - self::recursiveCopy( |
|
91 | - dirname(__FILE__) . '/application/tests/_ci_phpunit_test', |
|
92 | - $target_dir |
|
93 | - ); |
|
94 | - } |
|
86 | + public static function update($app = 'application') |
|
87 | + { |
|
88 | + $target_dir = $app . '/' . static::TEST_FOLDER . '/_ci_phpunit_test'; |
|
89 | + self::recursiveUnlink($target_dir); |
|
90 | + self::recursiveCopy( |
|
91 | + dirname(__FILE__) . '/application/tests/_ci_phpunit_test', |
|
92 | + $target_dir |
|
93 | + ); |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * Recursive Copy |
|
98 | - * |
|
99 | - * @param string $src |
|
100 | - * @param string $dst |
|
101 | - */ |
|
102 | - private static function recursiveCopy($src, $dst) |
|
103 | - { |
|
104 | - @mkdir($dst, 0755); |
|
96 | + /** |
|
97 | + * Recursive Copy |
|
98 | + * |
|
99 | + * @param string $src |
|
100 | + * @param string $dst |
|
101 | + */ |
|
102 | + private static function recursiveCopy($src, $dst) |
|
103 | + { |
|
104 | + @mkdir($dst, 0755); |
|
105 | 105 | |
106 | - $iterator = new \RecursiveIteratorIterator( |
|
107 | - new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
108 | - \RecursiveIteratorIterator::SELF_FIRST |
|
109 | - ); |
|
106 | + $iterator = new \RecursiveIteratorIterator( |
|
107 | + new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
108 | + \RecursiveIteratorIterator::SELF_FIRST |
|
109 | + ); |
|
110 | 110 | |
111 | - foreach ($iterator as $file) { |
|
112 | - if ($file->isDir()) { |
|
113 | - @mkdir($dst . '/' . $iterator->getSubPathName()); |
|
114 | - } else { |
|
115 | - $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
|
116 | - if ($success) { |
|
117 | - echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
|
118 | - } |
|
119 | - } |
|
120 | - } |
|
121 | - } |
|
111 | + foreach ($iterator as $file) { |
|
112 | + if ($file->isDir()) { |
|
113 | + @mkdir($dst . '/' . $iterator->getSubPathName()); |
|
114 | + } else { |
|
115 | + $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
|
116 | + if ($success) { |
|
117 | + echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
|
118 | + } |
|
119 | + } |
|
120 | + } |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * Recursive Unlink |
|
125 | - * |
|
126 | - * @param string $dir |
|
127 | - */ |
|
128 | - private static function recursiveUnlink($dir) |
|
129 | - { |
|
130 | - $iterator = new \RecursiveIteratorIterator( |
|
131 | - new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
132 | - \RecursiveIteratorIterator::CHILD_FIRST |
|
133 | - ); |
|
123 | + /** |
|
124 | + * Recursive Unlink |
|
125 | + * |
|
126 | + * @param string $dir |
|
127 | + */ |
|
128 | + private static function recursiveUnlink($dir) |
|
129 | + { |
|
130 | + $iterator = new \RecursiveIteratorIterator( |
|
131 | + new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
132 | + \RecursiveIteratorIterator::CHILD_FIRST |
|
133 | + ); |
|
134 | 134 | |
135 | - foreach ($iterator as $file) { |
|
136 | - if ($file->isDir()) { |
|
137 | - rmdir($file); |
|
138 | - } else { |
|
139 | - unlink($file); |
|
140 | - } |
|
141 | - } |
|
135 | + foreach ($iterator as $file) { |
|
136 | + if ($file->isDir()) { |
|
137 | + rmdir($file); |
|
138 | + } else { |
|
139 | + unlink($file); |
|
140 | + } |
|
141 | + } |
|
142 | 142 | |
143 | - rmdir($dir); |
|
144 | - } |
|
143 | + rmdir($dir); |
|
144 | + } |
|
145 | 145 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Part of ci-phpunit-test |
|
4 | - * |
|
5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | - * @license MIT License |
|
7 | - * @copyright 2015 Kenji Suzuki |
|
8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | - */ |
|
3 | + * Part of ci-phpunit-test |
|
4 | + * |
|
5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | + * @license MIT License |
|
7 | + * @copyright 2015 Kenji Suzuki |
|
8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | class CategorySeeder extends Seeder { |
12 | 12 |
@@ -13,7 +13,6 @@ |
||
13 | 13 | use PhpParser\Node; |
14 | 14 | use PhpParser\Node\Stmt\ClassMethod; |
15 | 15 | use PhpParser\NodeVisitorAbstract; |
16 | - |
|
17 | 16 | use Kenjis\MonkeyPatch\Patcher\MethodPatcher; |
18 | 17 | |
19 | 18 | class NodeVisitor extends NodeVisitorAbstract |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | public function enterNode(Node $node) |
26 | 26 | { |
27 | - $callback = [$this, 'before' . ucfirst($node->getType())]; |
|
27 | + $callback = [$this, 'before'.ucfirst($node->getType())]; |
|
28 | 28 | if (is_callable($callback)) { |
29 | 29 | call_user_func_array($callback, [$node]); |
30 | 30 | } |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | public function leaveNode(Node $node) |
34 | 34 | { |
35 | - if (! ($node instanceof ConstFetch)) |
|
35 | + if ( ! ($node instanceof ConstFetch)) |
|
36 | 36 | { |
37 | - $callback = [$this, 'rewrite' . ucfirst($node->getType())]; |
|
37 | + $callback = [$this, 'rewrite'.ucfirst($node->getType())]; |
|
38 | 38 | if (is_callable($callback)) { |
39 | 39 | call_user_func_array($callback, [$node]); |
40 | 40 | } |
@@ -47,24 +47,24 @@ discard block |
||
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | - if (! ($node->name instanceof Name)) |
|
50 | + if ( ! ($node->name instanceof Name)) |
|
51 | 51 | { |
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | - if (! $node->name->isUnqualified()) |
|
55 | + if ( ! $node->name->isUnqualified()) |
|
56 | 56 | { |
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
60 | 60 | $replacement = new FullyQualified(array()); |
61 | 61 | $replacement->set( |
62 | - '\__ConstProxy__::get(\'' . (string) $node->name . '\')' |
|
62 | + '\__ConstProxy__::get(\''.(string) $node->name.'\')' |
|
63 | 63 | ); |
64 | 64 | |
65 | 65 | $pos = $node->getAttribute('startTokenPos'); |
66 | 66 | ConstantPatcher::$replacement[$pos] = |
67 | - '\__ConstProxy__::get(\'' . (string) $node->name .'\')'; |
|
67 | + '\__ConstProxy__::get(\''.(string) $node->name.'\')'; |
|
68 | 68 | |
69 | 69 | $node->name = $replacement; |
70 | 70 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Part of ci-phpunit-test |
|
4 | - * |
|
5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | - * @license MIT License |
|
7 | - * @copyright 2016 Kenji Suzuki |
|
8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | - */ |
|
3 | + * Part of ci-phpunit-test |
|
4 | + * |
|
5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | + * @license MIT License |
|
7 | + * @copyright 2016 Kenji Suzuki |
|
8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | namespace Kenjis\MonkeyPatch\Patcher; |
12 | 12 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param string $constant constant name |
36 | 36 | * @param mixed $value value |
37 | - * @param string $class_name class::method to apply this patch |
|
37 | + * @param string $class_method class::method to apply this patch |
|
38 | 38 | * |
39 | 39 | * @throws LogicException |
40 | 40 | */ |
@@ -53,6 +53,9 @@ discard block |
||
53 | 53 | self::$patches_to_apply = []; |
54 | 54 | } |
55 | 55 | |
56 | + /** |
|
57 | + * @param string $constant |
|
58 | + */ |
|
56 | 59 | protected static function logInvocation($constant) |
57 | 60 | { |
58 | 61 | if (MonkeyPatchManager::$debug) |
@@ -70,6 +73,9 @@ discard block |
||
70 | 73 | } |
71 | 74 | } |
72 | 75 | |
76 | + /** |
|
77 | + * @param string $constant |
|
78 | + */ |
|
73 | 79 | protected static function checkCalledMethod($constant) |
74 | 80 | { |
75 | 81 | $trace = debug_backtrace(); |
@@ -13,14 +13,9 @@ |
||
13 | 13 | class_alias('Kenjis\MonkeyPatch\Patcher\ConstantPatcher\Proxy', '__ConstProxy__'); |
14 | 14 | |
15 | 15 | use LogicException; |
16 | -use ReflectionConstant; |
|
17 | -use ReflectionException; |
|
18 | - |
|
19 | 16 | use Kenjis\MonkeyPatch\Patcher\ConstantPatcher; |
20 | 17 | use Kenjis\MonkeyPatch\Patcher\Backtrace; |
21 | 18 | use Kenjis\MonkeyPatch\MonkeyPatchManager; |
22 | -use Kenjis\MonkeyPatch\Cache; |
|
23 | -use Kenjis\MonkeyPatch\InvocationVerifier; |
|
24 | 19 | |
25 | 20 | class Proxy |
26 | 21 | { |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Part of ci-phpunit-test |
|
4 | - * |
|
5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | - * @license MIT License |
|
7 | - * @copyright 2015 Kenji Suzuki |
|
8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | - */ |
|
3 | + * Part of ci-phpunit-test |
|
4 | + * |
|
5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | + * @license MIT License |
|
7 | + * @copyright 2015 Kenji Suzuki |
|
8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | class CategorySeeder extends Seeder { |
12 | 12 |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $method = isset($info['class_method']) ? $info['class_method'] : $info['function']; |
66 | 66 | |
67 | 67 | MonkeyPatchManager::log( |
68 | - 'invoke_const: ' . $constant . ') on line ' . $line . ' in ' . $file . ' by ' . $method . '()' |
|
68 | + 'invoke_const: '.$constant.') on line '.$line.' in '.$file.' by '.$method.'()' |
|
69 | 69 | ); |
70 | 70 | } |
71 | 71 | } |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | |
112 | 112 | if (isset(self::$patches_to_apply[$constant])) |
113 | 113 | { |
114 | - if (! self::checkCalledMethod($constant)) |
|
114 | + if ( ! self::checkCalledMethod($constant)) |
|
115 | 115 | { |
116 | 116 | MonkeyPatchManager::log( |
117 | - 'invoke_const: ' . $constant . ' not patched (out of scope)' |
|
117 | + 'invoke_const: '.$constant.' not patched (out of scope)' |
|
118 | 118 | ); |
119 | 119 | return constant($constant); |
120 | 120 | } |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | |
123 | 123 | if (array_key_exists($constant, self::$patches)) |
124 | 124 | { |
125 | - MonkeyPatchManager::log('invoke_const: ' . $constant . ' patched'); |
|
125 | + MonkeyPatchManager::log('invoke_const: '.$constant.' patched'); |
|
126 | 126 | return self::$patches[$constant]; |
127 | 127 | } |
128 | 128 | |
129 | 129 | MonkeyPatchManager::log( |
130 | - 'invoke_const: ' . $constant . ' not patched (no patch)' |
|
130 | + 'invoke_const: '.$constant.' not patched (no patch)' |
|
131 | 131 | ); |
132 | 132 | return constant($constant); |
133 | 133 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Part of ci-phpunit-test |
|
4 | - * |
|
5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | - * @license MIT License |
|
7 | - * @copyright 2016 Kenji Suzuki |
|
8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | - */ |
|
3 | + * Part of ci-phpunit-test |
|
4 | + * |
|
5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
6 | + * @license MIT License |
|
7 | + * @copyright 2016 Kenji Suzuki |
|
8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | namespace Kenjis\MonkeyPatch\Patcher; |
12 | 12 |
@@ -10,8 +10,8 @@ |
||
10 | 10 | |
11 | 11 | namespace Kenjis\MonkeyPatch\Patcher; |
12 | 12 | |
13 | -require __DIR__ . '/ConstantPatcher/NodeVisitor.php'; |
|
14 | -require __DIR__ . '/ConstantPatcher/Proxy.php'; |
|
13 | +require __DIR__.'/ConstantPatcher/NodeVisitor.php'; |
|
14 | +require __DIR__.'/ConstantPatcher/Proxy.php'; |
|
15 | 15 | |
16 | 16 | use LogicException; |
17 | 17 |
@@ -173,13 +173,11 @@ |
||
173 | 173 | if (is_string($token)) |
174 | 174 | { |
175 | 175 | $new_source .= $token; |
176 | - } |
|
177 | - elseif ($i == $replacement['key']) |
|
176 | + } elseif ($i == $replacement['key']) |
|
178 | 177 | { |
179 | 178 | $new_source .= $replacement['value']; |
180 | 179 | $replacement = each(self::$replacement); |
181 | - } |
|
182 | - else |
|
180 | + } else |
|
183 | 181 | { |
184 | 182 | $new_source .= $token[1]; |
185 | 183 | } |