|
@@ 82-99 (lines=18) @@
|
| 79 |
|
$this->assertEquals('test-user', $player->username, 'Username is the one I defined.'); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
public function testCreatePlayerWithMissingArgumentReturnsBadRequest() |
| 83 |
|
{ |
| 84 |
|
$client = $this->createClient(); |
| 85 |
|
|
| 86 |
|
$client->request('POST', '/api/players', array( |
| 87 |
|
'username' => '', |
| 88 |
|
'password' => 'test-pass', |
| 89 |
|
)); |
| 90 |
|
|
| 91 |
|
$this->assertEquals(Response::HTTP_BAD_REQUEST, $client->getResponse()->getStatusCode()); |
| 92 |
|
|
| 93 |
|
$client->request('POST', '/api/players', array( |
| 94 |
|
'username' => 'test-user', |
| 95 |
|
'password' => '', |
| 96 |
|
)); |
| 97 |
|
|
| 98 |
|
$this->assertEquals(Response::HTTP_BAD_REQUEST, $client->getResponse()->getStatusCode()); |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
public function testCreatePlayerTwiceReturnsConflictStatusCode() |
| 102 |
|
{ |
|
@@ 101-118 (lines=18) @@
|
| 98 |
|
$this->assertEquals(Response::HTTP_BAD_REQUEST, $client->getResponse()->getStatusCode()); |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
public function testCreatePlayerTwiceReturnsConflictStatusCode() |
| 102 |
|
{ |
| 103 |
|
$client = $this->createClient(); |
| 104 |
|
|
| 105 |
|
$client->request('POST', '/api/players', array( |
| 106 |
|
'username' => 'test-user', |
| 107 |
|
'password' => 'test-pass', |
| 108 |
|
)); |
| 109 |
|
|
| 110 |
|
$this->assertEquals(Response::HTTP_CREATED, $client->getResponse()->getStatusCode()); |
| 111 |
|
|
| 112 |
|
$client->request('POST', '/api/players', array( |
| 113 |
|
'username' => 'test-user', |
| 114 |
|
'password' => 'test-pass', |
| 115 |
|
)); |
| 116 |
|
|
| 117 |
|
$this->assertEquals(Response::HTTP_CONFLICT, $client->getResponse()->getStatusCode()); |
| 118 |
|
} |
| 119 |
|
|
| 120 |
|
public function testCreateGuestReturnsAGuest() |
| 121 |
|
{ |