1 | <?php |
||
9 | use SlayerBirden\DataFlowServer\Domain\Entities\User; |
||
10 | |||
11 | class CreatePasswordCest |
||
12 | { |
||
13 | /** |
||
14 | * @var int |
||
15 | */ |
||
16 | private $userId; |
||
17 | |||
18 | public function _before(ApiTester $I) |
||
39 | |||
40 | /** |
||
41 | * @param ApiTester $I |
||
42 | * @throws Exception |
||
43 | */ |
||
44 | public function createPasswordSuccess(ApiTester $I) |
||
65 | |||
66 | /** |
||
67 | * @param ApiTester $I |
||
68 | * @param int $userId |
||
69 | * @throws Exception |
||
70 | */ |
||
71 | private function authForUser(ApiTester $I, int $userId) |
||
84 | |||
85 | /** |
||
86 | * @param ApiTester $I |
||
87 | * @throws Exception |
||
88 | */ |
||
89 | public function createPasswordNoPasswordProvided(ApiTester $I) |
||
108 | |||
109 | /** |
||
110 | * @param ApiTester $I |
||
111 | * @throws \Exception |
||
112 | */ |
||
113 | public function createPasswordUserAlreadyHasPassword(ApiTester $I) |
||
135 | |||
136 | /** |
||
137 | * @param ApiTester $I |
||
138 | * @throws \Exception |
||
139 | */ |
||
140 | public function createPasswordException(ApiTester $I) |
||
141 | { |
||
142 | $I->wantTo('create password short password'); |
||
143 | $this->authForUser($I, $this->userId); |
||
144 | $I->haveHttpHeader('Content-Type', 'application/json'); |
||
145 | $I->sendPOST('/password', [ |
||
146 | 'password' => 'test123', |
||
147 | 'owner' => 'mr twister', |
||
148 | ]); |
||
149 | $I->seeResponseCodeIs(HttpCode::BAD_REQUEST); |
||
150 | $I->seeResponseContainsJson([ |
||
151 | 'success' => false, |
||
152 | 'data' => [ |
||
153 | 'password' => null, |
||
154 | 'validation' => [ |
||
155 | [ |
||
156 | 'field' => 'password' |
||
157 | ] |
||
158 | ], |
||
159 | ], |
||
160 | ]); |
||
161 | } |
||
163 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.