@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param string $function function name |
| 39 | 39 | * @param mixed $return_value return value or callable |
| 40 | - * @param string $class_name class::method to apply this patch |
|
| 40 | + * @param string $class_method class::method to apply this patch |
|
| 41 | 41 | * |
| 42 | 42 | * @throws LogicException |
| 43 | 43 | */ |
@@ -86,6 +86,9 @@ discard block |
||
| 86 | 86 | InvocationVerifier::verify(self::$expected_invocations, self::$invocations); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | + /** |
|
| 90 | + * @param string $function |
|
| 91 | + */ |
|
| 89 | 92 | protected static function logInvocation($function, $arguments) |
| 90 | 93 | { |
| 91 | 94 | if (MonkeyPatchManager::$debug) |
@@ -111,6 +114,9 @@ discard block |
||
| 111 | 114 | } |
| 112 | 115 | } |
| 113 | 116 | |
| 117 | + /** |
|
| 118 | + * @param string $function |
|
| 119 | + */ |
|
| 114 | 120 | protected static function checkCalledMethod($function) |
| 115 | 121 | { |
| 116 | 122 | $trace = debug_backtrace(); |
@@ -184,6 +190,9 @@ discard block |
||
| 184 | 190 | return call_user_func_array($function, $arguments); |
| 185 | 191 | } |
| 186 | 192 | |
| 193 | + /** |
|
| 194 | + * @param string $function |
|
| 195 | + */ |
|
| 187 | 196 | protected static function checkPassedByReference($function) |
| 188 | 197 | { |
| 189 | 198 | $ref_func = new ReflectionFunction($function); |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | use LogicException; |
| 16 | 16 | use ReflectionFunction; |
| 17 | 17 | use ReflectionException; |
| 18 | - |
|
| 19 | 18 | use Kenjis\MonkeyPatch\Patcher\FunctionPatcher; |
| 20 | 19 | use Kenjis\MonkeyPatch\Patcher\Backtrace; |
| 21 | 20 | use Kenjis\MonkeyPatch\MonkeyPatchManager; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | self::outputMessage($msg); |
| 52 | 52 | throw new LogicException($msg); |
| 53 | 53 | } |
| 54 | - if (! FunctionPatcher::isWhitelisted($function)) |
|
| 54 | + if ( ! FunctionPatcher::isWhitelisted($function)) |
|
| 55 | 55 | { |
| 56 | 56 | $msg = "<red>Can't patch on '$function'. It is not in whitelist. If you want to patch it, please add it to 'functions_to_patch' in 'tests/Bootstrap.php'. But note that there are some limitations. See <https://github.com/kenjis/ci-phpunit-test/blob/master/docs/HowToWriteTests.md#patching-functions> for details.</red>"; |
| 57 | 57 | self::outputMessage($msg); |
@@ -97,16 +97,16 @@ discard block |
||
| 97 | 97 | $line = $info['line']; |
| 98 | 98 | $method = isset($info['class_method']) ? $info['class_method'] : $info['function']; |
| 99 | 99 | |
| 100 | - $log_args = function () use ($arguments) { |
|
| 100 | + $log_args = function() use ($arguments) { |
|
| 101 | 101 | $output = ''; |
| 102 | 102 | foreach ($arguments as $arg) { |
| 103 | - $output .= var_export($arg, true) . ', '; |
|
| 103 | + $output .= var_export($arg, true).', '; |
|
| 104 | 104 | } |
| 105 | 105 | $output = rtrim($output, ', '); |
| 106 | 106 | return $output; |
| 107 | 107 | }; |
| 108 | 108 | MonkeyPatchManager::log( |
| 109 | - 'invoke_func: ' . $function . '(' . $log_args() . ') on line ' . $line . ' in ' . $file . ' by ' . $method . '()' |
|
| 109 | + 'invoke_func: '.$function.'('.$log_args().') on line '.$line.' in '.$file.' by '.$method.'()' |
|
| 110 | 110 | ); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | if (isset(self::$patches_to_apply[$function])) |
| 150 | 150 | { |
| 151 | - if (! self::checkCalledMethod($function)) |
|
| 151 | + if ( ! self::checkCalledMethod($function)) |
|
| 152 | 152 | { |
| 153 | 153 | MonkeyPatchManager::log( |
| 154 | - 'invoke_func: ' . $function . '() not patched (out of scope)' |
|
| 154 | + 'invoke_func: '.$function.'() not patched (out of scope)' |
|
| 155 | 155 | ); |
| 156 | 156 | self::checkPassedByReference($function); |
| 157 | 157 | return call_user_func_array($function, $arguments); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | if (array_key_exists($function, self::$patches)) |
| 162 | 162 | { |
| 163 | - MonkeyPatchManager::log('invoke_func: ' . $function . '() patched'); |
|
| 163 | + MonkeyPatchManager::log('invoke_func: '.$function.'() patched'); |
|
| 164 | 164 | |
| 165 | 165 | if (is_callable(self::$patches[$function])) |
| 166 | 166 | { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | MonkeyPatchManager::log( |
| 181 | - 'invoke_func: ' . $function . '() not patched (no patch)' |
|
| 181 | + 'invoke_func: '.$function.'() not patched (no patch)' |
|
| 182 | 182 | ); |
| 183 | 183 | self::checkPassedByReference($function); |
| 184 | 184 | return call_user_func_array($function, $arguments); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $msg = str_replace( |
| 232 | 232 | ['<red>', '</red>'], [$red_begin, $red_end], $msg |
| 233 | 233 | ); |
| 234 | - echo $msg . "\n"; |
|
| 234 | + echo $msg."\n"; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -13,8 +13,6 @@ |
||
| 13 | 13 | require __DIR__ . '/MethodPatcher/NodeVisitor.php'; |
| 14 | 14 | require __DIR__ . '/MethodPatcher/PatchManager.php'; |
| 15 | 15 | |
| 16 | -use LogicException; |
|
| 17 | - |
|
| 18 | 16 | use Kenjis\MonkeyPatch\Patcher\MethodPatcher\NodeVisitor; |
| 19 | 17 | |
| 20 | 18 | class MethodPatcher extends AbstractPatcher |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | namespace Kenjis\MonkeyPatch\Patcher; |
| 12 | 12 | |
| 13 | -require __DIR__ . '/MethodPatcher/NodeVisitor.php'; |
|
| 14 | -require __DIR__ . '/MethodPatcher/PatchManager.php'; |
|
| 13 | +require __DIR__.'/MethodPatcher/NodeVisitor.php'; |
|
| 14 | +require __DIR__.'/MethodPatcher/PatchManager.php'; |
|
| 15 | 15 | |
| 16 | 16 | use LogicException; |
| 17 | 17 | |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | if ($start_method && $token === '{') |
| 66 | 66 | { |
| 67 | - if(self::isVoidFunction($tokens, $key)){ |
|
| 68 | - $new_source .= '{ ' . self::CODENORET; |
|
| 67 | + if (self::isVoidFunction($tokens, $key)) { |
|
| 68 | + $new_source .= '{ '.self::CODENORET; |
|
| 69 | 69 | } |
| 70 | - else{ |
|
| 71 | - $new_source .= '{ ' . self::CODE; |
|
| 70 | + else { |
|
| 71 | + $new_source .= '{ '.self::CODE; |
|
| 72 | 72 | } |
| 73 | 73 | $start_method = false; |
| 74 | 74 | $replacement['key'] = key(self::$replacement); |
@@ -100,22 +100,22 @@ discard block |
||
| 100 | 100 | * @param $key |
| 101 | 101 | * @return bool |
| 102 | 102 | */ |
| 103 | - protected static function isVoidFunction($tokens, $key){ |
|
| 104 | - if($key - 1 <= 0){ |
|
| 103 | + protected static function isVoidFunction($tokens, $key) { |
|
| 104 | + if ($key - 1 <= 0) { |
|
| 105 | 105 | return false; |
| 106 | 106 | } |
| 107 | 107 | $token = $tokens[$key - 1]; |
| 108 | - if(is_array($token)){ |
|
| 108 | + if (is_array($token)) { |
|
| 109 | 109 | $token = $token[1]; |
| 110 | 110 | } |
| 111 | 111 | //Loop backwards though the start of the function block till you either find "void" or the end of the |
| 112 | 112 | //parameters declaration. |
| 113 | - while($token !== ")"){ |
|
| 114 | - if(strpos($token, "void") !== false){ |
|
| 113 | + while ($token !== ")") { |
|
| 114 | + if (strpos($token, "void") !== false) { |
|
| 115 | 115 | return true; |
| 116 | 116 | } |
| 117 | 117 | $token = $tokens[$key - 1]; |
| 118 | - if(is_array($token)){ |
|
| 118 | + if (is_array($token)) { |
|
| 119 | 119 | $token = $token[1]; |
| 120 | 120 | } |
| 121 | 121 | $key--; |
@@ -66,8 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | if(self::isVoidFunction($tokens, $key)){ |
| 68 | 68 | $new_source .= '{ ' . self::CODENORET; |
| 69 | - } |
|
| 70 | - else{ |
|
| 69 | + } else{ |
|
| 71 | 70 | $new_source .= '{ ' . self::CODE; |
| 72 | 71 | } |
| 73 | 72 | $start_method = false; |
@@ -78,13 +77,11 @@ discard block |
||
| 78 | 77 | { |
| 79 | 78 | $replacement = false; |
| 80 | 79 | } |
| 81 | - } |
|
| 82 | - else |
|
| 80 | + } else |
|
| 83 | 81 | { |
| 84 | 82 | $new_source .= $token; |
| 85 | 83 | } |
| 86 | - } |
|
| 87 | - else |
|
| 84 | + } else |
|
| 88 | 85 | { |
| 89 | 86 | $new_source .= $token[1]; |
| 90 | 87 | } |
@@ -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 |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | public function leaveNode(Node $node) |
| 22 | 22 | { |
| 23 | - if (! ($node instanceof ClassMethod)) |
|
| 23 | + if ( ! ($node instanceof ClassMethod)) |
|
| 24 | 24 | { |
| 25 | 25 | return; |
| 26 | 26 | } |
@@ -38,8 +38,7 @@ |
||
| 38 | 38 | { |
| 39 | 39 | $patched = true; |
| 40 | 40 | $new_source = static::generateNewSource($source); |
| 41 | - } |
|
| 42 | - else |
|
| 41 | + } else |
|
| 43 | 42 | { |
| 44 | 43 | $new_source = $source; |
| 45 | 44 | } |
@@ -66,16 +66,16 @@ |
||
| 66 | 66 | $called_method = 'n/a'; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - $log_args = function () use ($params) { |
|
| 69 | + $log_args = function() use ($params) { |
|
| 70 | 70 | $output = ''; |
| 71 | 71 | foreach ($params as $arg) { |
| 72 | - $output .= var_export($arg, true) . ', '; |
|
| 72 | + $output .= var_export($arg, true).', '; |
|
| 73 | 73 | } |
| 74 | 74 | $output = rtrim($output, ', '); |
| 75 | 75 | return $output; |
| 76 | 76 | }; |
| 77 | 77 | MonkeyPatchManager::log( |
| 78 | - 'invoke_method: ' . $class.'::'.$method . '(' . $log_args() . ') on line ' . $line . ' in ' . $file . ' by ' . $called_method |
|
| 78 | + 'invoke_method: '.$class.'::'.$method.'('.$log_args().') on line '.$line.' in '.$file.' by '.$called_method |
|
| 79 | 79 | ); |
| 80 | 80 | // var_dump($trace); exit; |
| 81 | 81 | } |
@@ -56,12 +56,10 @@ discard block |
||
| 56 | 56 | if (isset($info['class_method'])) |
| 57 | 57 | { |
| 58 | 58 | $called_method = $info['class_method']; |
| 59 | - } |
|
| 60 | - elseif (isset($info['function'])) |
|
| 59 | + } elseif (isset($info['function'])) |
|
| 61 | 60 | { |
| 62 | 61 | $called_method = $info['function']; |
| 63 | - } |
|
| 64 | - else |
|
| 62 | + } else |
|
| 65 | 63 | { |
| 66 | 64 | $called_method = 'n/a'; |
| 67 | 65 | } |
@@ -88,8 +86,7 @@ discard block |
||
| 88 | 86 | ) |
| 89 | 87 | { |
| 90 | 88 | $patch = self::$patches[$class][$method]; |
| 91 | - } |
|
| 92 | - else |
|
| 89 | + } else |
|
| 93 | 90 | { |
| 94 | 91 | return __GO_TO_ORIG__; |
| 95 | 92 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -27,20 +27,17 @@ |
||
| 27 | 27 | if (is_string($token)) |
| 28 | 28 | { |
| 29 | 29 | $new_source .= $token; |
| 30 | - } |
|
| 31 | - elseif ($token[0] === T_EXIT) |
|
| 30 | + } elseif ($token[0] === T_EXIT) |
|
| 32 | 31 | { |
| 33 | 32 | if ($tokens[$i+1] === ';') |
| 34 | 33 | { |
| 35 | 34 | $new_source .= 'exit__()'; |
| 36 | - } |
|
| 37 | - else |
|
| 35 | + } else |
|
| 38 | 36 | { |
| 39 | 37 | $new_source .= 'exit__'; |
| 40 | 38 | } |
| 41 | 39 | $patched = true; |
| 42 | - } |
|
| 43 | - else |
|
| 40 | + } else |
|
| 44 | 41 | { |
| 45 | 42 | $new_source .= $token[1]; |
| 46 | 43 | } |
@@ -12,36 +12,36 @@ |
||
| 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 | |
@@ -13,8 +13,7 @@ |
||
| 13 | 13 | if (class_exists('PhpParser\Node\Identifier')) { |
| 14 | 14 | // PHP-Parser 4.x |
| 15 | 15 | require __DIR__ . '/4.x/MonkeyPatchManager.php'; |
| 16 | - } |
|
| 17 | - elseif (method_exists('PhpParser\Node\Name','set')) { |
|
| 16 | + } elseif (method_exists('PhpParser\Node\Name','set')) { |
|
| 18 | 17 | // PHP-Parser 2.x |
| 19 | 18 | require __DIR__ . '/2.x/MonkeyPatchManager.php'; |
| 20 | 19 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | // Support PHPUnit 6.0 |
| 46 | 46 | if (! class_exists('PHPUnit_Util_Configuration')) { |
| 47 | - class_alias('PHPUnit\Util\Configuration', 'PHPUnit_Util_Configuration'); |
|
| 47 | + class_alias('PHPUnit\Util\Configuration', 'PHPUnit_Util_Configuration'); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -57,71 +57,71 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | final class TestSuiteProvider |
| 59 | 59 | { |
| 60 | - /** |
|
| 61 | - * phpunit configuration file |
|
| 62 | - * |
|
| 63 | - * @var string |
|
| 64 | - */ |
|
| 65 | - private static $file; |
|
| 60 | + /** |
|
| 61 | + * phpunit configuration file |
|
| 62 | + * |
|
| 63 | + * @var string |
|
| 64 | + */ |
|
| 65 | + private static $file; |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * constructor |
|
| 69 | - */ |
|
| 70 | - private function __construct() {} |
|
| 67 | + /** |
|
| 68 | + * constructor |
|
| 69 | + */ |
|
| 70 | + private function __construct() {} |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * set the phpunit configuration file |
|
| 74 | - * |
|
| 75 | - * @param string $file the path or filename of the phunit configuration file |
|
| 76 | - */ |
|
| 77 | - public static function setConfigurationFile($file) |
|
| 78 | - { |
|
| 79 | - static::$file = $file; |
|
| 80 | - } |
|
| 72 | + /** |
|
| 73 | + * set the phpunit configuration file |
|
| 74 | + * |
|
| 75 | + * @param string $file the path or filename of the phunit configuration file |
|
| 76 | + */ |
|
| 77 | + public static function setConfigurationFile($file) |
|
| 78 | + { |
|
| 79 | + static::$file = $file; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * get the phpunit test suite instance |
|
| 84 | - * |
|
| 85 | - * @return PHPUnit_Framework_TestSuite returns the phpunit test suite instance |
|
| 86 | - * @throws FileNotFoundException if the file is not found |
|
| 87 | - */ |
|
| 88 | - public static function suite() |
|
| 89 | - { |
|
| 90 | - $file = static::checkConfigurationFile( |
|
| 91 | - static::getConfigurationFile() |
|
| 92 | - ); |
|
| 82 | + /** |
|
| 83 | + * get the phpunit test suite instance |
|
| 84 | + * |
|
| 85 | + * @return PHPUnit_Framework_TestSuite returns the phpunit test suite instance |
|
| 86 | + * @throws FileNotFoundException if the file is not found |
|
| 87 | + */ |
|
| 88 | + public static function suite() |
|
| 89 | + { |
|
| 90 | + $file = static::checkConfigurationFile( |
|
| 91 | + static::getConfigurationFile() |
|
| 92 | + ); |
|
| 93 | 93 | |
| 94 | - return PHPUnit_Util_Configuration::getInstance($file) |
|
| 95 | - ->getTestSuiteConfiguration(); |
|
| 96 | - } |
|
| 94 | + return PHPUnit_Util_Configuration::getInstance($file) |
|
| 95 | + ->getTestSuiteConfiguration(); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * get the phpunit configuration file |
|
| 100 | - * |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - private static function getConfigurationFile() |
|
| 104 | - { |
|
| 105 | - static::$file = isset(static::$file) |
|
| 106 | - ? static::$file |
|
| 107 | - : TESTPATH.'phpunit.xml'; |
|
| 98 | + /** |
|
| 99 | + * get the phpunit configuration file |
|
| 100 | + * |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + private static function getConfigurationFile() |
|
| 104 | + { |
|
| 105 | + static::$file = isset(static::$file) |
|
| 106 | + ? static::$file |
|
| 107 | + : TESTPATH.'phpunit.xml'; |
|
| 108 | 108 | |
| 109 | - return static::$file; |
|
| 110 | - } |
|
| 109 | + return static::$file; |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * check the given file |
|
| 114 | - * |
|
| 115 | - * @param string $file file to check |
|
| 116 | - * @return string returns the file if it is valid |
|
| 117 | - * @throws FileNotFoundException if the file is not found |
|
| 118 | - */ |
|
| 119 | - private static function checkConfigurationFile($file) |
|
| 120 | - { |
|
| 121 | - if (!file_exists($file)) { |
|
| 122 | - throw new \RuntimeException("The requested phpunit configuration was not found at $file"); |
|
| 123 | - } |
|
| 112 | + /** |
|
| 113 | + * check the given file |
|
| 114 | + * |
|
| 115 | + * @param string $file file to check |
|
| 116 | + * @return string returns the file if it is valid |
|
| 117 | + * @throws FileNotFoundException if the file is not found |
|
| 118 | + */ |
|
| 119 | + private static function checkConfigurationFile($file) |
|
| 120 | + { |
|
| 121 | + if (!file_exists($file)) { |
|
| 122 | + throw new \RuntimeException("The requested phpunit configuration was not found at $file"); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - return $file; |
|
| 126 | - } |
|
| 125 | + return $file; |
|
| 126 | + } |
|
| 127 | 127 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -35,7 +35,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |