|
@@ 78-93 (lines=16) @@
|
| 75 |
|
$this->assertEquals(422, $this->client->getResponse()->getStatusCode()); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
public function testGetAllGroups() |
| 79 |
|
{ |
| 80 |
|
$this->logIn('ROLE_SUPER_ADMIN'); |
| 81 |
|
$this->client->request('GET', '/api/groups'); |
| 82 |
|
|
| 83 |
|
$this->assertJsonResponse($this->client->getResponse()); |
| 84 |
|
$this->assertCount(3, $this->getResponseContent()); |
| 85 |
|
$this->assertCollectionContainsObject( |
| 86 |
|
$this->em->find("Overwatch\TestBundle\Entity\TestGroup", TestGroupFixtures::$groups['group-1']->getId()), |
| 87 |
|
$this->getResponseContent() |
| 88 |
|
); |
| 89 |
|
$this->assertCollectionContainsObject( |
| 90 |
|
$this->em->find("Overwatch\TestBundle\Entity\TestGroup", TestGroupFixtures::$groups['group-2']->getId()), |
| 91 |
|
$this->getResponseContent() |
| 92 |
|
); |
| 93 |
|
} |
| 94 |
|
|
| 95 |
|
public function testGetAllGroupsAsUser() |
| 96 |
|
{ |
|
@@ 95-110 (lines=16) @@
|
| 92 |
|
); |
| 93 |
|
} |
| 94 |
|
|
| 95 |
|
public function testGetAllGroupsAsUser() |
| 96 |
|
{ |
| 97 |
|
$this->loginAs( |
| 98 |
|
$this->em->find("Overwatch\UserBundle\Entity\User", UserFixtures::$users['user-2']->getId()), |
| 99 |
|
'overwatch' |
| 100 |
|
); |
| 101 |
|
$this->client = $this->makeClient(); //When using loginAs, we must use a new client |
| 102 |
|
$this->client->request('GET', '/api/groups'); |
| 103 |
|
|
| 104 |
|
$this->assertJsonResponse($this->client->getResponse()); |
| 105 |
|
$this->assertCount(1, $this->getResponseContent()); |
| 106 |
|
$this->assertCollectionContainsObject( |
| 107 |
|
$this->em->find("Overwatch\TestBundle\Entity\TestGroup", TestGroupFixtures::$groups['group-1']->getId()), |
| 108 |
|
$this->getResponseContent() |
| 109 |
|
); |
| 110 |
|
} |
| 111 |
|
|
| 112 |
|
public function testGetGroup() |
| 113 |
|
{ |