@@ -22,7 +22,7 @@ |
||
| 22 | 22 | if ($success) { |
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | - echo "Test $this->taskCount failed. $text\n"; |
|
| 25 | + echo "test $this->taskCount failed. $text\n"; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | return $this->taskCount; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - protected function showStringOrArray(string|array $variable): string |
|
| 54 | + protected function showStringOrArray(string | array $variable): string |
|
| 55 | 55 | { |
| 56 | 56 | return (is_string($variable) ? $variable : "(array)"); |
| 57 | 57 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * Does $actual contain $needle? |
| 154 | 154 | */ |
| 155 | - protected function assertContains(string|array $needle, string|array $actual): void |
|
| 155 | + protected function assertContains(string | array $needle, string | array $actual): void |
|
| 156 | 156 | { |
| 157 | 157 | if (is_string($actual) && is_string($needle)) { |
| 158 | 158 | $success = ($needle !== "" && str_contains($actual, $needle)); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | /** |
| 174 | 174 | * Does $actual not contain $needle? |
| 175 | 175 | */ |
| 176 | - protected function assertNotContains(string|array $needle, string|array $actual): void |
|
| 176 | + protected function assertNotContains(string | array $needle, string | array $actual): void |
|
| 177 | 177 | { |
| 178 | 178 | if (is_string($actual) && is_string($needle)) { |
| 179 | 179 | $success = ($needle === "" || !str_contains($actual, $needle)); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | /** |
| 192 | 192 | * Does $value contain $count items? |
| 193 | 193 | */ |
| 194 | - protected function assertCount(int $count, string|array|\Countable $value): void |
|
| 194 | + protected function assertCount(int $count, string | array | \Countable $value): void |
|
| 195 | 195 | { |
| 196 | 196 | if (!is_array($value) && !$value instanceof \Countable) { |
| 197 | 197 | $this->testResult("The variable is not array or countable object.", false); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | /** |
| 207 | 207 | * Does $value not contain $count items? |
| 208 | 208 | */ |
| 209 | - protected function assertNotCount(int $count, string|array|\Countable $value): void |
|
| 209 | + protected function assertNotCount(int $count, string | array | \Countable $value): void |
|
| 210 | 210 | { |
| 211 | 211 | if (!is_array($value) && !$value instanceof \Countable) { |
| 212 | 212 | $this->testResult("The variable is not array or countable object.", false); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | /** |
| 222 | 222 | * Is $value of type $type? |
| 223 | 223 | */ |
| 224 | - protected function assertType(string|object $type, mixed $value): void |
|
| 224 | + protected function assertType(string | object $type, mixed $value): void |
|
| 225 | 225 | { |
| 226 | 226 | if ( |
| 227 | 227 | in_array($type, [ |
@@ -42,15 +42,15 @@ |
||
| 42 | 42 | try { |
| 43 | 43 | $reflection = new ReflectionMethod($class, $dataProvider); |
| 44 | 44 | if (!$reflection->isPublic()) { |
| 45 | - throw new InvalidDataProviderException("Method $className::$dataProvider is not public."); |
|
| 45 | + throw new InvalidDataProviderException("method $className::$dataProvider is not public."); |
|
| 46 | 46 | } |
| 47 | 47 | $result = call_user_func([$class, $dataProvider]); |
| 48 | 48 | if (!is_array($result)) { |
| 49 | - throw new InvalidDataProviderException("Method $className::$dataProvider has to return an array."); |
|
| 49 | + throw new InvalidDataProviderException("method $className::$dataProvider has to return an array."); |
|
| 50 | 50 | } |
| 51 | 51 | return $result; |
| 52 | 52 | } catch (\ReflectionException $e) { |
| 53 | - throw new InvalidDataProviderException("Method $className::$dataProvider does not exist.", 0, $e); |
|
| 53 | + throw new InvalidDataProviderException("method $className::$dataProvider does not exist.", 0, $e); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | return []; |
@@ -11,12 +11,12 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | final class DummyEngine implements \MyTester\IAnnotationsReaderEngine |
| 13 | 13 | { |
| 14 | - public function hasAnnotation(string $name, string|object $class, string $method = null): bool |
|
| 14 | + public function hasAnnotation(string $name, string | object $class, string $method = null): bool |
|
| 15 | 15 | { |
| 16 | 16 | return true; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function getAnnotation(string $name, string|object $class, string $method = null): mixed |
|
| 19 | + public function getAnnotation(string $name, string | object $class, string $method = null): mixed |
|
| 20 | 20 | { |
| 21 | 21 | return "abc"; |
| 22 | 22 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | interface IAnnotationsReaderEngine |
| 12 | 12 | { |
| 13 | - public function hasAnnotation(string $name, string|object $class, string $method = null): bool; |
|
| 13 | + public function hasAnnotation(string $name, string | object $class, string $method = null): bool; |
|
| 14 | 14 | |
| 15 | - public function getAnnotation(string $name, string|object $class, string $method = null): mixed; |
|
| 15 | + public function getAnnotation(string $name, string | object $class, string $method = null): mixed; |
|
| 16 | 16 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | /** |
| 50 | 50 | * Check whether to skip a test method |
| 51 | 51 | */ |
| 52 | - public function shouldSkip(string $class, string $method): bool|string |
|
| 52 | + public function shouldSkip(string $class, string $method): bool | string |
|
| 53 | 53 | { |
| 54 | 54 | $value = $this->getSkipValue($class, $method); |
| 55 | 55 | if ($value === null) { |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $this->engines[] = $engine; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function hasAnnotation(string $name, string|object $class, string $method = null): bool |
|
| 25 | + public function hasAnnotation(string $name, string | object $class, string $method = null): bool |
|
| 26 | 26 | { |
| 27 | 27 | foreach ($this->engines as $engine) { |
| 28 | 28 | if ($engine->hasAnnotation($name, $class, $method)) { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function getAnnotation(string $name, string|object $class, string $method = null): mixed |
|
| 35 | + public function getAnnotation(string $name, string | object $class, string $method = null): mixed |
|
| 36 | 36 | { |
| 37 | 37 | foreach ($this->engines as $engine) { |
| 38 | 38 | $value = $engine->getAnnotation($name, $class, $method); |
@@ -21,9 +21,9 @@ |
||
| 21 | 21 | $this->container = $container; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @param class-string $className |
|
| 26 | - */ |
|
| 24 | + /** |
|
| 25 | + * @param class-string $className |
|
| 26 | + */ |
|
| 27 | 27 | public function create(string $className): TestCase |
| 28 | 28 | { |
| 29 | 29 | $suit = $this->container->getByType($className); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | /** |
| 102 | 102 | * Get name for a job |
| 103 | 103 | */ |
| 104 | - protected function getJobName(string|object $class, string $method): string |
|
| 104 | + protected function getJobName(string | object $class, string $method): string |
|
| 105 | 105 | { |
| 106 | 106 | $annotation = $this->annotationsReader->getAnnotation(static::ANNOTATION_TEST, $class, $method); |
| 107 | 107 | if ($annotation !== null) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $this->tearDown(); |
| 150 | 150 | } |
| 151 | 151 | $this->resetCounter(); |
| 152 | - return match ($job->result) { |
|
| 152 | + return match($job->result) { |
|
| 153 | 153 | Job::RESULT_PASSED => static::RESULT_PASSED, |
| 154 | 154 | Job::RESULT_SKIPPED => static::RESULT_SKIPPED, |
| 155 | 155 | Job::RESULT_FAILED => static::RESULT_FAILED, |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** @var callable Task */ |
| 28 | 28 | protected $callback; |
| 29 | 29 | protected array $params = []; |
| 30 | - protected bool|string $skip; |
|
| 30 | + protected bool | string $skip; |
|
| 31 | 31 | protected string $result = self::RESULT_PASSED; |
| 32 | 32 | protected string $output = ""; |
| 33 | 33 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | string $name, |
| 36 | 36 | callable $callback, |
| 37 | 37 | array $params = [], |
| 38 | - bool|string $skip = false |
|
| 38 | + bool | string $skip = false |
|
| 39 | 39 | ) { |
| 40 | 40 | $this->name = $name; |
| 41 | 41 | $this->callback = $callback; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | return $this->params; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - protected function getSkip(): bool|string |
|
| 61 | + protected function getSkip(): bool | string |
|
| 62 | 62 | { |
| 63 | 63 | return $this->skip; |
| 64 | 64 | } |