php-kitchen /
code-specs
| 1 | <?php |
||
| 2 | |||
| 3 | namespace PHPKitchen\CodeSpecs\Expectation\Routing; |
||
| 4 | |||
| 5 | use PHPKitchen\CodeSpecs\Expectation\Internal\StepsList; |
||
| 6 | use PHPKitchen\CodeSpecs\Expectation\Matcher\ArrayMatcher; |
||
| 7 | use PHPKitchen\CodeSpecs\Expectation\Matcher\BooleanMatcher; |
||
| 8 | use PHPKitchen\CodeSpecs\Expectation\Matcher\ClassMatcher; |
||
| 9 | use PHPKitchen\CodeSpecs\Expectation\Matcher\DirectoryMatcher; |
||
| 10 | use PHPKitchen\CodeSpecs\Expectation\Matcher\FileMatcher; |
||
| 11 | use PHPKitchen\CodeSpecs\Expectation\Matcher\NumberMatcher; |
||
| 12 | use PHPKitchen\CodeSpecs\Expectation\Matcher\ObjectMatcher; |
||
| 13 | use PHPKitchen\CodeSpecs\Expectation\Matcher\StringMatcher; |
||
| 14 | use PHPKitchen\CodeSpecs\Mixin\TestGuyMethods; |
||
|
0 ignored issues
–
show
|
|||
| 15 | |||
| 16 | class Router { |
||
| 17 | public const IN_TIME_EXPECTATION_MODE = 1; |
||
| 18 | public const DEFERRED_EXPECTATION_MODE = 0; |
||
| 19 | protected $variableName = ''; |
||
| 20 | protected $mode; |
||
| 21 | |||
| 22 | public function __construct(string $variableName, int $mode = self::IN_TIME_EXPECTATION_MODE) { |
||
| 23 | $this->variableName = $variableName; |
||
| 24 | $this->mode = $mode; |
||
| 25 | } |
||
| 26 | //region ----------------------- SPECIFICATION METHODS ----------------------- |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Starts a chain of asserts from {@link StringMatcher}. |
||
| 30 | * |
||
| 31 | * @param string $variable variable to be tested |
||
| 32 | * |
||
| 33 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\StringMatcher |
||
| 34 | */ |
||
| 35 | public function seeString($string): StringMatcher { |
||
| 36 | return $this->dispatch($string) |
||
| 37 | ->isString(); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Starts a chain of asserts from {@link ArrayMatcher}. |
||
| 42 | * |
||
| 43 | * @param array|\ArrayAccess $variable variable to be tested |
||
| 44 | * |
||
| 45 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\ArrayMatcher |
||
| 46 | */ |
||
| 47 | public function seeArray($variable): ArrayMatcher { |
||
| 48 | return $this->dispatch($variable) |
||
| 49 | ->isArray(); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Starts a chain of asserts from {@link BooleanMatcher}. |
||
| 54 | * |
||
| 55 | * @param boolean $variable variable to be tested |
||
| 56 | * |
||
| 57 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\BooleanMatcher |
||
| 58 | */ |
||
| 59 | public function seeBool($variable): BooleanMatcher { |
||
| 60 | return $this->dispatch($variable) |
||
| 61 | ->isBoolean(); |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Starts a chain of asserts from {@link NumberMatcher}. |
||
| 66 | * |
||
| 67 | * @param int|float $variable variable to be tested |
||
| 68 | * |
||
| 69 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\NumberMatcher |
||
| 70 | */ |
||
| 71 | public function seeNumber($variable): NumberMatcher { |
||
| 72 | return $this->dispatch($variable) |
||
| 73 | ->isNumber(); |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Starts a chain of asserts from {@link ObjectMatcher}. |
||
| 78 | * |
||
| 79 | * @param object $variable variable to be tested |
||
| 80 | * |
||
| 81 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\ObjectMatcher |
||
| 82 | */ |
||
| 83 | public function seeObject($variable): ObjectMatcher { |
||
| 84 | return $this->dispatch($variable) |
||
| 85 | ->isObject(); |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * Starts a chain of asserts from {@link ClassMatcher}. |
||
| 90 | * |
||
| 91 | * @param string $variable variable to be tested |
||
| 92 | * |
||
| 93 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\ClassMatcher |
||
| 94 | */ |
||
| 95 | public function seeClass($variable): ClassMatcher { |
||
| 96 | return $this->dispatch($variable) |
||
| 97 | ->isClass(); |
||
| 98 | } |
||
| 99 | |||
| 100 | /** |
||
| 101 | * Starts a chain of asserts from {@link FileMatcher}. |
||
| 102 | * |
||
| 103 | * @param string $variable variable to be tested |
||
| 104 | * |
||
| 105 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\FileMatcher |
||
| 106 | */ |
||
| 107 | public function seeFile($variable): FileMatcher { |
||
| 108 | return $this->dispatch($variable) |
||
| 109 | ->isFile(); |
||
| 110 | } |
||
| 111 | |||
| 112 | /** |
||
| 113 | * Starts a chain of asserts from {@link DirectoryMatcher}. |
||
| 114 | * |
||
| 115 | * @param string $variable variable to be tested |
||
| 116 | * |
||
| 117 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\DirectoryMatcher |
||
| 118 | */ |
||
| 119 | public function seeDirectory($variable): DirectoryMatcher { |
||
| 120 | return $this->dispatch($variable) |
||
| 121 | ->isDirectory(); |
||
| 122 | } |
||
| 123 | //endregion |
||
| 124 | |||
| 125 | //region ----------------------- UTIL METHODS ----------------------- |
||
| 126 | |||
| 127 | protected function initStepsList() { |
||
| 128 | $this->steps = StepsList::getInstance(); |
||
|
0 ignored issues
–
show
|
|||
| 129 | $this->steps->clear(); |
||
| 130 | } |
||
| 131 | |||
| 132 | private function dispatch($actualValue): Dispatcher { |
||
| 133 | $dispatcher = new Dispatcher($actualValue, $this->variableName, $this->mode); |
||
| 134 | $this->variableName = ''; |
||
| 135 | |||
| 136 | return $dispatcher; |
||
| 137 | } |
||
| 138 | //endregion |
||
| 139 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths