|
@@ 66-78 (lines=13) @@
|
| 63 |
|
$this->assertTrue(array_key_exists('token', $session)); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
public function testTryCreateSessionWithWrongPassword() { |
| 67 |
|
$data = [ |
| 68 |
|
'email' => '[email protected]', |
| 69 |
|
'password' => 'wrongPass' |
| 70 |
|
]; |
| 71 |
|
|
| 72 |
|
$dataString = json_encode($data); |
| 73 |
|
$result = $this->makeApiRequest('SessionRoute', ['body' => $dataString, 'method' => 'POST', 'code' => 401]); |
| 74 |
|
|
| 75 |
|
$this->assertTrue(array_key_exists('code', $result)); |
| 76 |
|
$this->assertTrue(array_key_exists('message', $result)); |
| 77 |
|
$this->assertEquals(401, $result['code']); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
public function testTryCreateSessionWithWrongEmail() { |
| 81 |
|
$data = [ |
|
@@ 80-92 (lines=13) @@
|
| 77 |
|
$this->assertEquals(401, $result['code']); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
public function testTryCreateSessionWithWrongEmail() { |
| 81 |
|
$data = [ |
| 82 |
|
'email' => 'foo.com', |
| 83 |
|
'password' => 'wrong' |
| 84 |
|
]; |
| 85 |
|
|
| 86 |
|
$dataString = json_encode($data); |
| 87 |
|
$result = $this->makeApiRequest('SessionRoute', ['body' => $dataString, 'method' => 'POST', 'code' => 422]); |
| 88 |
|
|
| 89 |
|
$this->assertTrue(array_key_exists('code', $result)); |
| 90 |
|
$this->assertTrue(array_key_exists('message', $result)); |
| 91 |
|
$this->assertEquals(422, $result['code']); |
| 92 |
|
} |
| 93 |
|
} |
| 94 |
|
|
| 95 |
|
|