php-kitchen /
code-specs
| 1 | <?php |
||
| 2 | |||
| 3 | namespace PHPKitchen\CodeSpecs\Contract; |
||
| 4 | |||
| 5 | use PHPKitchen\CodeSpecs\Directive\Wait; |
||
| 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\Expectation\Matcher\ValueMatcher; |
||
| 15 | use PHPKitchen\CodeSpecs\Expectation\Routing\DeferredDispatcher; |
||
|
0 ignored issues
–
show
|
|||
| 16 | |||
| 17 | /** |
||
| 18 | * Represents a test-guy who is testing your code, so tests writes as a story of what tester is doing. |
||
| 19 | * |
||
| 20 | * @method TestGuy expectTo(string $expectation) |
||
| 21 | * |
||
| 22 | * @author Dima Kolodko <[email protected]> |
||
| 23 | */ |
||
| 24 | interface TestGuy { |
||
| 25 | /** |
||
| 26 | * Specifies scenario test guy is working on. |
||
| 27 | * |
||
| 28 | * @param string $scenario scenario name. |
||
| 29 | * Scenario should be a logical ending of "I describe ". For example: "process of user registration". |
||
| 30 | * Such scenario would result in "I describe process of user registration" output in console. |
||
| 31 | * |
||
| 32 | * @return $this |
||
| 33 | */ |
||
| 34 | public function describe(string $scenario): TestGuy; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Specifies what test guy expects from a set of matchers that would be defined next in the |
||
| 38 | * specification. |
||
| 39 | * |
||
| 40 | * @param string $expectation expectation text. |
||
| 41 | * Expectation should be a logical ending of "I expect that ". For example: "user is added to the DB". |
||
| 42 | * Such scenario would result in "I expect that user is added to the DB" output in console. |
||
| 43 | * |
||
| 44 | * @return $this |
||
| 45 | */ |
||
| 46 | public function expectThat(string $expectation): TestGuy; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Specifies what test guy expects from a set of matchers that would be defined next in the |
||
| 50 | * specification. |
||
| 51 | * |
||
| 52 | * @param string $expectation expectation text. |
||
| 53 | * Expectation should be a logical ending of "I expect to ". For example: "see user in the DB". |
||
| 54 | * Such scenario would result in "I expect to see user in the DB" output in console. |
||
| 55 | * @param callable $verificationSteps callable function with following definition "function (TestGuy $I) { ..." that contains a group of |
||
| 56 | * expectations united by one verification topic. All of the expectations would be executed once they |
||
| 57 | * are defined. |
||
| 58 | * |
||
| 59 | * @return $this |
||
| 60 | */ |
||
| 61 | public function verifyThat(string $expectation, callable $verificationSteps = null): TestGuy; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Specifies name of a variable test guy would check. |
||
| 65 | * |
||
| 66 | * @param string $variableName name of a variable to look at. |
||
| 67 | * |
||
| 68 | * @return TestGuy |
||
| 69 | */ |
||
| 70 | public function lookAt(string $variableName): TestGuy; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Creates runtime matcher that you can use to perform typical asserts. |
||
| 74 | * Runtime matcher is an object that represents a set of asserts from a typical matcher that |
||
| 75 | * aren't executed at a time they were defined but would be executed every time runtime matcher object |
||
| 76 | * would be called as a function with one argument - value to assert. |
||
| 77 | * |
||
| 78 | * For example: |
||
| 79 | * <code> |
||
| 80 | * $userHasName = $I->match('user')->isArray()->isNotEmpty()->hasKey('name'); |
||
| 81 | * $userHasName($admin); |
||
| 82 | * $userHasName($member); |
||
| 83 | * </code> |
||
| 84 | * |
||
| 85 | * @param string $variableName name of a variable to look at. |
||
| 86 | * |
||
| 87 | * @return \PHPKitchen\CodeSpecs\Expectation\Routing\DeferredDispatcher |
||
| 88 | */ |
||
| 89 | public function match(string $variableName): DeferredDispatcher; |
||
| 90 | |||
| 91 | /** |
||
| 92 | * Stops execution for specified number of units of time. |
||
| 93 | * |
||
| 94 | * @param int $numberOfTimeUnits number of units of time. |
||
| 95 | * {@link Wait} specifies what unit should be used. |
||
| 96 | * |
||
| 97 | * @return Wait |
||
| 98 | */ |
||
| 99 | public function wait($numberOfTimeUnits): Wait; |
||
| 100 | |||
| 101 | /** |
||
| 102 | * Starts a chain of asserts from {@link ValueMatcher}. |
||
| 103 | * |
||
| 104 | * @param mixed $variable variable to be tested |
||
| 105 | * |
||
| 106 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\ValueMatcher |
||
| 107 | */ |
||
| 108 | public function see($variable): ValueMatcher; |
||
| 109 | |||
| 110 | /** |
||
| 111 | * Starts a chain of asserts from {@link StringMatcher}. |
||
| 112 | * |
||
| 113 | * @param string $variable variable to be tested |
||
| 114 | * |
||
| 115 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\StringMatcher |
||
| 116 | */ |
||
| 117 | public function seeString($variable): StringMatcher; |
||
| 118 | |||
| 119 | /** |
||
| 120 | * Starts a chain of asserts from {@link ArrayMatcher}. |
||
| 121 | * |
||
| 122 | * @param array|\ArrayAccess $variable variable to be tested |
||
| 123 | * |
||
| 124 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\ArrayMatcher |
||
| 125 | */ |
||
| 126 | public function seeArray($variable): ArrayMatcher; |
||
| 127 | |||
| 128 | /** |
||
| 129 | * Starts a chain of asserts from {@link BooleanMatcher}. |
||
| 130 | * |
||
| 131 | * @param boolean $variable variable to be tested |
||
| 132 | * |
||
| 133 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\BooleanMatcher |
||
| 134 | */ |
||
| 135 | public function seeBool($variable): BooleanMatcher; |
||
| 136 | |||
| 137 | /** |
||
| 138 | * Starts a chain of asserts from {@link NumberMatcher}. |
||
| 139 | * |
||
| 140 | * @param int|float $variable variable to be tested |
||
| 141 | * |
||
| 142 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\NumberMatcher |
||
| 143 | */ |
||
| 144 | public function seeNumber($variable): NumberMatcher; |
||
| 145 | |||
| 146 | /** |
||
| 147 | * Starts a chain of asserts from {@link ObjectMatcher}. |
||
| 148 | * |
||
| 149 | * @param object $variable variable to be tested |
||
| 150 | * |
||
| 151 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\ObjectMatcher |
||
| 152 | */ |
||
| 153 | public function seeObject($variable): ObjectMatcher; |
||
| 154 | |||
| 155 | /** |
||
| 156 | * Starts a chain of asserts from {@link ClassMatcher}. |
||
| 157 | * |
||
| 158 | * @param string $variable variable to be tested |
||
| 159 | * |
||
| 160 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\ClassMatcher |
||
| 161 | */ |
||
| 162 | public function seeClass($variable): ClassMatcher; |
||
| 163 | |||
| 164 | /** |
||
| 165 | * Starts a chain of asserts from {@link FileMatcher}. |
||
| 166 | * |
||
| 167 | * @param string $variable variable to be tested |
||
| 168 | * |
||
| 169 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\FileMatcher |
||
| 170 | */ |
||
| 171 | public function seeFile($variable): FileMatcher; |
||
| 172 | |||
| 173 | /** |
||
| 174 | * Starts a chain of asserts from {@link DirectoryMatcher}. |
||
| 175 | * |
||
| 176 | * @param string $variable variable to be tested |
||
| 177 | * |
||
| 178 | * @return \PHPKitchen\CodeSpecs\Expectation\Matcher\DirectoryMatcher |
||
| 179 | */ |
||
| 180 | public function seeDirectory($variable): DirectoryMatcher; |
||
| 181 | } |
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