Completed
Pull Request — master (#364)
by Kenji
02:25
created
tests/_ci_phpunit_test/patcher/4.x/Patcher/ConstantPatcher/Proxy.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			$method = isset($info['class_method']) ? $info['class_method'] : $info['function'];
64 64
 
65 65
 			MonkeyPatchManager::log(
66
-				'invoke_const: ' . $constant . ') on line ' . $line . ' in ' . $file . ' by ' . $method . '()'
66
+				'invoke_const: '.$constant.') on line '.$line.' in '.$file.' by '.$method.'()'
67 67
 			);
68 68
 		}
69 69
 	}
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 	{
107 107
 		self::logInvocation($constant);
108 108
 
109
-		if (! empty(self::$patches_to_apply[$constant]))
109
+		if ( ! empty(self::$patches_to_apply[$constant]))
110 110
 		{
111
-			if (! self::checkCalledMethod($constant))
111
+			if ( ! self::checkCalledMethod($constant))
112 112
 			{
113 113
 				MonkeyPatchManager::log(
114
-					'invoke_const: ' . $constant . ' not patched (out of scope)'
114
+					'invoke_const: '.$constant.' not patched (out of scope)'
115 115
 				);
116 116
 				return constant($constant);
117 117
 			}
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
 
120 120
 		if (array_key_exists($constant, self::$patches))
121 121
 		{
122
-			MonkeyPatchManager::log('invoke_const: ' . $constant . ' patched');
122
+			MonkeyPatchManager::log('invoke_const: '.$constant.' patched');
123 123
 			return self::$patches[$constant];
124 124
 		}
125 125
 
126 126
 		MonkeyPatchManager::log(
127
-			'invoke_const: ' . $constant . ' not patched (no patch)'
127
+			'invoke_const: '.$constant.' not patched (no patch)'
128 128
 		);
129 129
 		return constant($constant);
130 130
 	}
Please login to merge, or discard this patch.
tests/_ci_phpunit_test/patcher/4.x/Patcher/ConstantPatcher/NodeVisitor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,23 +47,23 @@  discard block
 block discarded – undo
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
-		if (! ConstantPatcher::isBlacklisted((string) $node->name))
60
+		if ( ! ConstantPatcher::isBlacklisted((string) $node->name))
61 61
 		{
62
-			$replacement = new FullyQualified('\__ConstProxy__::get(\'' . (string) $node->name . '\')');
62
+			$replacement = new FullyQualified('\__ConstProxy__::get(\''.(string) $node->name.'\')');
63 63
 
64 64
 			$pos = $node->getAttribute('startTokenPos');
65 65
 			ConstantPatcher::$replacement[$pos] = 
66
-				'\__ConstProxy__::get(\'' . (string) $node->name .'\')';
66
+				'\__ConstProxy__::get(\''.(string) $node->name.'\')';
67 67
 
68 68
 			$node->name = $replacement;
69 69
 		}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/patcher/4.x/Patcher/ExitPatcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 namespace Kenjis\MonkeyPatch\Patcher;
12 12
 
13
-require __DIR__ . '/../Exception/ExitException.php';
13
+require __DIR__.'/../Exception/ExitException.php';
14 14
 
15 15
 class ExitPatcher
16 16
 {
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 			}
31 31
 			elseif ($token[0] === T_EXIT)
32 32
 			{
33
-				if ($tokens[$i+1] === ';')
33
+				if ($tokens[$i + 1] === ';')
34 34
 				{
35 35
 					$new_source .= 'exit__()';
36 36
 				}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/patcher/bootstrap.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,36 +12,36 @@
 block discarded – undo
12 12
 if (class_exists('PhpParser\Autoloader')) {
13 13
 	if (class_exists('PhpParser\Node\Identifier')) {
14 14
 		// PHP-Parser 4.x
15
-		require __DIR__ . '/4.x/MonkeyPatchManager.php';
15
+		require __DIR__.'/4.x/MonkeyPatchManager.php';
16 16
 	}
17
-	elseif (method_exists('PhpParser\Node\Name','set')) {
17
+	elseif (method_exists('PhpParser\Node\Name', 'set')) {
18 18
 		// PHP-Parser 2.x
19
-		require __DIR__ . '/2.x/MonkeyPatchManager.php';
19
+		require __DIR__.'/2.x/MonkeyPatchManager.php';
20 20
 	} else {
21 21
 		// PHP-Parser 3.x
22
-		require __DIR__ . '/3.x/MonkeyPatchManager.php';
22
+		require __DIR__.'/3.x/MonkeyPatchManager.php';
23 23
 	}
24 24
 }
25 25
 // If you don't use Composer
26 26
 else {
27 27
 	if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
28 28
 		// Use PHP-Parser 3.x
29
-		require __DIR__ . '/third_party/PHP-Parser-3.1.5/lib/bootstrap.php';
30
-		require __DIR__ . '/3.x/MonkeyPatchManager.php';
29
+		require __DIR__.'/third_party/PHP-Parser-3.1.5/lib/bootstrap.php';
30
+		require __DIR__.'/3.x/MonkeyPatchManager.php';
31 31
 	} else {
32 32
 		// Use PHP-Parser 2.x
33
-		require __DIR__ . '/third_party/PHP-Parser-2.1.1/lib/bootstrap.php';
34
-		require __DIR__ . '/2.x/MonkeyPatchManager.php';
33
+		require __DIR__.'/third_party/PHP-Parser-2.1.1/lib/bootstrap.php';
34
+		require __DIR__.'/2.x/MonkeyPatchManager.php';
35 35
 	}
36 36
 }
37 37
 
38
-require __DIR__ . '/IncludeStream.php';
39
-require __DIR__ . '/PathChecker.php';
40
-require __DIR__ . '/MonkeyPatch.php';
41
-require __DIR__ . '/Cache.php';
42
-require __DIR__ . '/InvocationVerifier.php';
38
+require __DIR__.'/IncludeStream.php';
39
+require __DIR__.'/PathChecker.php';
40
+require __DIR__.'/MonkeyPatch.php';
41
+require __DIR__.'/Cache.php';
42
+require __DIR__.'/InvocationVerifier.php';
43 43
 
44
-require __DIR__ . '/functions/exit__.php';
44
+require __DIR__.'/functions/exit__.php';
45 45
 
46 46
 const __GO_TO_ORIG__ = '__GO_TO_ORIG__';
47 47
 
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/TestSuiteProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 use PHPUnit_Util_Configuration;
44 44
 
45 45
 // Support PHPUnit 6.0
46
-if (! class_exists('PHPUnit_Util_Configuration')) {
46
+if ( ! class_exists('PHPUnit_Util_Configuration')) {
47 47
     class_alias('PHPUnit\Util\Configuration', 'PHPUnit_Util_Configuration');
48 48
 }
49 49
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      */
119 119
     private static function checkConfigurationFile($file)
120 120
     {
121
-        if (!file_exists($file)) {
121
+        if ( ! file_exists($file)) {
122 122
             throw new \RuntimeException("The requested phpunit configuration was not found at $file");
123 123
         }
124 124
 
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/functions.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	reset_config();
33 33
 
34 34
 	// Close db connection
35
-	$CI =& get_instance();
35
+	$CI = & get_instance();
36 36
 	if (isset($CI->db))
37 37
 	{
38 38
 		if (
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	// Load core classes
55
-	$BM =& load_class('Benchmark', 'core');
55
+	$BM = & load_class('Benchmark', 'core');
56 56
 	CIPHPUnitTestSuperGlobal::set_Global('BM', $BM);
57
-	$EXT =& load_class('Hooks', 'core');
57
+	$EXT = & load_class('Hooks', 'core');
58 58
 	CIPHPUnitTestSuperGlobal::set_Global('EXT', $EXT);
59 59
 
60
-	$CFG =& load_class('Config', 'core');
60
+	$CFG = & load_class('Config', 'core');
61 61
 	CIPHPUnitTestSuperGlobal::set_Global('CFG', $CFG);
62 62
 	// Do we have any manually set config items in the index.php file?
63 63
 	global $assign_to_config;
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 		}
70 70
 	}
71 71
 
72
-	$UNI =& load_class('URI', 'core');
72
+	$UNI = & load_class('URI', 'core');
73 73
 	CIPHPUnitTestSuperGlobal::set_Global('UNI', $UNI);
74 74
 //	$URI =& load_class('Utf8', 'core');
75 75
 //	CIPHPUnitTestSuperGlobal::set_Global('URI', $URI);
76
-	$RTR =& load_class('Router', 'core');
76
+	$RTR = & load_class('Router', 'core');
77 77
 	CIPHPUnitTestSuperGlobal::set_Global('RTR', $RTR);
78
-	$OUT =& load_class('Output', 'core');
78
+	$OUT = & load_class('Output', 'core');
79 79
 	CIPHPUnitTestSuperGlobal::set_Global('OUT', $OUT);
80
-	$SEC =& load_class('Security', 'core');
80
+	$SEC = & load_class('Security', 'core');
81 81
 	CIPHPUnitTestSuperGlobal::set_Global('SEC', $SEC);
82
-	$IN =& load_class('Input', 'core');
82
+	$IN = & load_class('Input', 'core');
83 83
 	CIPHPUnitTestSuperGlobal::set_Global('IN', $IN);
84
-	$LANG =& load_class('Lang', 'core');
84
+	$LANG = & load_class('Lang', 'core');
85 85
 	CIPHPUnitTestSuperGlobal::set_Global('LANG', $LANG);
86 86
 
87 87
 	CIPHPUnitTest::loadLoader();
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/CIPHPUnitTestDbTestCase.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	{
36 36
 		if ($this->db === null)
37 37
 		{
38
-			$CI =& get_instance();
38
+			$CI = & get_instance();
39 39
 			$CI->load->database();
40 40
 			$this->db = $CI->db;
41 41
 		}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	{
57 57
 		$this->checkDbConnId();
58 58
 		
59
-		if (! empty($this->insertCache))
59
+		if ( ! empty($this->insertCache))
60 60
 		{
61 61
 			foreach ($this->insertCache as $row)
62 62
 			{
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$this->db->close();
84 84
 		$this->db = null;
85 85
 
86
-		$CI =& get_instance();
86
+		$CI = & get_instance();
87 87
 		$CI->load->database();
88 88
 		$this->db = $CI->db;
89 89
 	}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/replacing/core/Common.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	if ($_log === NULL)
202 202
 	{
203 203
 		// references cannot be directly assigned to static variables, so we use an array
204
-		$_log[0] =& load_class('Log', 'core');
204
+		$_log[0] = & load_class('Log', 'core');
205 205
 	}
206 206
 
207 207
 	$_log[0]->write_log($level, $message);
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 
292 292
 	// Save status code in Output object
293 293
 	// added by ci-phpunit-test
294
-	$CI =& get_instance();
294
+	$CI = & get_instance();
295 295
 	$output = $CI->output;
296 296
 	$output->_status = [
297 297
 		'code'     => $code,
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	if (empty($_config))
406 406
 	{
407 407
 		// references cannot be directly assigned to static variables, so we use an array
408
-		$_config[0] =& get_config();
408
+		$_config[0] = & get_config();
409 409
 	}
410 410
 
411 411
 	return isset($_config[0][$item]) ? $_config[0][$item] : NULL;
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/CIPHPUnitTest.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -43,26 +43,26 @@  discard block
 block discarded – undo
43 43
 		$cwd_backup = getcwd();
44 44
 
45 45
 		// Load autoloader for ci-phpunit-test
46
-		require __DIR__ . '/autoloader.php';
46
+		require __DIR__.'/autoloader.php';
47 47
 
48 48
 		self::loadTestCaseClasses();
49 49
 
50 50
 		// Replace a few Common functions
51
-		require __DIR__ . '/replacing/core/Common.php';
52
-		require BASEPATH . 'core/Common.php';
51
+		require __DIR__.'/replacing/core/Common.php';
52
+		require BASEPATH.'core/Common.php';
53 53
 
54 54
 		// Workaround for missing CodeIgniter's error handler
55 55
 		// See https://github.com/kenjis/ci-phpunit-test/issues/37
56 56
 		set_error_handler('_error_handler');
57 57
 
58 58
 		// Load new functions of CIPHPUnitTest
59
-		require __DIR__ . '/functions.php';
59
+		require __DIR__.'/functions.php';
60 60
 		// Load ci-phpunit-test CI_Loader
61
-		require __DIR__ . '/replacing/core/Loader.php';
61
+		require __DIR__.'/replacing/core/Loader.php';
62 62
 		// Load ci-phpunit-test CI_Input
63
-		require __DIR__ . '/replacing/core/Input.php';
63
+		require __DIR__.'/replacing/core/Input.php';
64 64
 		// Load ci-phpunit-test CI_Output
65
-		require __DIR__ . '/replacing/core/Output.php';
65
+		require __DIR__.'/replacing/core/Output.php';
66 66
 
67 67
 		// Change current directory
68 68
 		chdir(FCPATH);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		self::loadCodeIgniter();
71 71
 
72 72
 		// Create CodeIgniter instance
73
-		if (! self::wiredesignzHmvcInstalled())
73
+		if ( ! self::wiredesignzHmvcInstalled())
74 74
 		{
75 75
 			new CI_Controller();
76 76
 		}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		chdir($cwd_backup);
93 93
 	}
94 94
 
95
-	private static function loadCodeIgniter(){
95
+	private static function loadCodeIgniter() {
96 96
 		// Load constants.php before replacing helpers,
97 97
 		// because config_item() loads config.php
98 98
 		if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
@@ -115,31 +115,31 @@  discard block
 block discarded – undo
115 115
 		 *
116 116
 		 * And away we go...
117 117
 		 */
118
-		require __DIR__ . '/replacing/core/CodeIgniter.php';
118
+		require __DIR__.'/replacing/core/CodeIgniter.php';
119 119
 	}
120 120
 
121 121
 	private static function defineConstants()
122 122
 	{
123
-		if (! defined('TESTPATH')) {
123
+		if ( ! defined('TESTPATH')) {
124 124
 			define('TESTPATH', APPPATH.'tests'.DIRECTORY_SEPARATOR);
125 125
 		}
126 126
 		// Current Bootstrap.php should define this, but in case it doesn't:
127
-		if (! defined('CI_PHPUNIT_TESTPATH')) {
127
+		if ( ! defined('CI_PHPUNIT_TESTPATH')) {
128 128
 			define('CI_PHPUNIT_TESTPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
129 129
 		}
130 130
 	}
131 131
 
132 132
 	private static function loadTestCaseClasses()
133 133
 	{
134
-		require TESTPATH . 'TestCase.php';
134
+		require TESTPATH.'TestCase.php';
135 135
 
136
-		$db_test_case_file = TESTPATH . 'DbTestCase.php';
136
+		$db_test_case_file = TESTPATH.'DbTestCase.php';
137 137
 		if (is_readable($db_test_case_file))
138 138
 		{
139 139
 			require $db_test_case_file;
140 140
 		}
141 141
 
142
-		$unit_test_case_file = TESTPATH . 'UnitTestCase.php';
142
+		$unit_test_case_file = TESTPATH.'UnitTestCase.php';
143 143
 		if (is_readable($unit_test_case_file))
144 144
 		{
145 145
 			require $unit_test_case_file;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public static function createCodeIgniterInstance($use_my_controller = false)
153 153
 	{
154
-		if (! self::wiredesignzHmvcInstalled())
154
+		if ( ! self::wiredesignzHmvcInstalled())
155 155
 		{
156 156
 			if ($use_my_controller && self::hasMyController())
157 157
 			{
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 		}
177 177
 
178 178
 		$my_controller_file =
179
-			APPPATH . 'core/' . config_item('subclass_prefix') . 'Controller.php';
179
+			APPPATH.'core/'.config_item('subclass_prefix').'Controller.php';
180 180
 
181 181
 		if (file_exists($my_controller_file))
182 182
 		{
183
-			$controller_class = config_item('subclass_prefix') . 'Controller';
183
+			$controller_class = config_item('subclass_prefix').'Controller';
184 184
 			if ( ! class_exists($controller_class))
185 185
 			{
186 186
 				require $my_controller_file;
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 	protected static function replaceLoader()
213 213
 	{
214 214
 		$my_loader_file =
215
-			APPPATH . 'core/' . config_item('subclass_prefix') . 'Loader.php';
215
+			APPPATH.'core/'.config_item('subclass_prefix').'Loader.php';
216 216
 
217 217
 		if (file_exists($my_loader_file))
218 218
 		{
219
-			self::$loader_class = config_item('subclass_prefix') . 'Loader';
219
+			self::$loader_class = config_item('subclass_prefix').'Loader';
220 220
 			if ( ! class_exists(self::$loader_class))
221 221
 			{
222 222
 				require $my_loader_file;
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 	protected static function replaceConfig()
229 229
 	{
230 230
 		$my_config_file =
231
-			APPPATH . 'core/' . config_item('subclass_prefix') . 'Config.php';
231
+			APPPATH.'core/'.config_item('subclass_prefix').'Config.php';
232 232
 
233 233
 		if (file_exists($my_config_file))
234 234
 		{
235
-			self::$config_class = config_item('subclass_prefix') . 'Config';
235
+			self::$config_class = config_item('subclass_prefix').'Config';
236 236
 			if ( ! class_exists(self::$config_class))
237 237
 			{
238 238
 				require $my_config_file;
@@ -251,19 +251,19 @@  discard block
 block discarded – undo
251 251
 
252 252
 	protected static function loadHelper($helper)
253 253
 	{
254
-		$my_helper_file = APPPATH . 'helpers/' . config_item('subclass_prefix') . $helper . '.php';
254
+		$my_helper_file = APPPATH.'helpers/'.config_item('subclass_prefix').$helper.'.php';
255 255
 		if (file_exists($my_helper_file))
256 256
 		{
257 257
 			require $my_helper_file;
258 258
 		}
259
-		require __DIR__ . '/replacing/helpers/' . $helper . '.php';
259
+		require __DIR__.'/replacing/helpers/'.$helper.'.php';
260 260
 	}
261 261
 
262 262
 	public static function setPatcherCacheDir($dir = null)
263 263
 	{
264 264
 		if ($dir === null)
265 265
 		{
266
-			$dir = CI_PHPUNIT_TESTPATH . 'tmp/cache';
266
+			$dir = CI_PHPUNIT_TESTPATH.'tmp/cache';
267 267
 		}
268 268
 
269 269
 		MonkeyPatchManager::setCacheDir(
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
 	public static function loadConfig()
281 281
 	{
282
-		$config= new self::$config_class;
282
+		$config = new self::$config_class;
283 283
 		load_class_instance('Config', $config);
284 284
 	}
285 285
 }
Please login to merge, or discard this patch.