|
@@ 57-65 (lines=9) @@
|
| 54 |
|
self::assertEquals($content1, $content2); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
public function testDoubleEmail() |
| 58 |
|
{ |
| 59 |
|
$user = entity(User::class)->create(['originalPassword' => 'testPassword']); |
| 60 |
|
$this->json('POST', '/register', [ |
| 61 |
|
'email' => $user->getEmail(), |
| 62 |
|
'password' => 'testPassword2' |
| 63 |
|
])->seeStatusCode(422)->seeJsonEquals(["errors" => ["email" => ["The email has already been taken."]], |
| 64 |
|
"message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
public function testEmailRequiredValidation() |
| 68 |
|
{ |
|
@@ 75-82 (lines=8) @@
|
| 72 |
|
"message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]); |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
public function testEmailRequiredValidationLogin() |
| 76 |
|
{ |
| 77 |
|
entity(User::class)->create(['originalPassword' => 'testPassword']); |
| 78 |
|
$this->json('POST', '/login', [ |
| 79 |
|
'password' => 'testPassword' |
| 80 |
|
])->seeStatusCode(422)->seeJsonEquals(["errors" => ["email" => ["The email field is required."]], |
| 81 |
|
"message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]); |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
public function testInvalidCredentials() |
| 85 |
|
{ |
|
@@ 108-116 (lines=9) @@
|
| 105 |
|
"message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]); |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
public function testInvalidEmailValidationLogin() |
| 109 |
|
{ |
| 110 |
|
entity(User::class)->create(['originalPassword' => 'testPassword']); |
| 111 |
|
$this->json('POST', '/login', [ |
| 112 |
|
'email' => 'invalidEmail', |
| 113 |
|
'password' => 'testPassword' |
| 114 |
|
])->seeStatusCode(422)->seeJsonEquals(["errors" => ["email" => ["The email must be a valid email address."]], |
| 115 |
|
"message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]); |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
public function testInvalidId() |
| 119 |
|
{ |
|
@@ 187-196 (lines=10) @@
|
| 184 |
|
"message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]); |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
public function testNoStringPasswordLogin() |
| 188 |
|
{ |
| 189 |
|
/** @var UserInterface $user */ |
| 190 |
|
$user = entity(User::class)->create(['originalPassword' => 'testPassword']); |
| 191 |
|
$this->json('POST', '/login', [ |
| 192 |
|
'email' => $user->getEmail(), |
| 193 |
|
'password' => 16511233 |
| 194 |
|
])->seeStatusCode(422)->seeJsonEquals(["errors" => ["password" => ["The password must be a string."]], |
| 195 |
|
"message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]); |
| 196 |
|
} |
| 197 |
|
|
| 198 |
|
public function testPasswordRequiredValidation() |
| 199 |
|
{ |
|
@@ 206-214 (lines=9) @@
|
| 203 |
|
"message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]); |
| 204 |
|
} |
| 205 |
|
|
| 206 |
|
public function testPasswordRequiredValidationLogin() |
| 207 |
|
{ |
| 208 |
|
/** @var UserInterface $user */ |
| 209 |
|
$user = entity(User::class)->create(['originalPassword' => 'testPassword']); |
| 210 |
|
$this->json('POST', '/login', [ |
| 211 |
|
'email' => $user->getEmail() |
| 212 |
|
])->seeStatusCode(422)->seeJsonEquals(["errors" => ["password" => ["The password field is required."]], |
| 213 |
|
"message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]); |
| 214 |
|
} |
| 215 |
|
|
| 216 |
|
public function testRegisterUser() |
| 217 |
|
{ |
|
@@ 259-269 (lines=11) @@
|
| 256 |
|
"message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]); |
| 257 |
|
} |
| 258 |
|
|
| 259 |
|
public function testTooShortPasswordLogin() |
| 260 |
|
{ |
| 261 |
|
/** @var UserInterface $user */ |
| 262 |
|
$user = entity(User::class)->create(['originalPassword' => 'testPassword']); |
| 263 |
|
$this->json('POST', '/login', [ |
| 264 |
|
'email' => $user->getEmail(), |
| 265 |
|
'password' => 'short' |
| 266 |
|
])->seeStatusCode(422)->seeJsonEquals(["errors" => [ |
| 267 |
|
"password" => ["The password must be at least 8 characters."]], |
| 268 |
|
"message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]); |
| 269 |
|
} |
| 270 |
|
|
| 271 |
|
public function testWrongPassword() |
| 272 |
|
{ |