diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-01 09:52:38 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-01 09:52:38 +0200 |
commit | f808b01692a835673f328d7221ba8c212caa9b61 (patch) | |
tree | 0c3b1fc5b1ddbd7af72227303503177689e1d403 /tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php | |
parent | 822c877949aff8ae57677671115f8f4fc69588d5 (diff) | |
download | wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.gz wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.zst wallabag-f808b01692a835673f328d7221ba8c212caa9b61.zip |
Add a real configuration for CS-Fixer
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php index 53aed12b..2caeccf5 100644 --- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php | |||
@@ -15,7 +15,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
15 | $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); | 15 | $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); |
16 | 16 | ||
17 | $crawler = $client->request('GET', '/developer/client/create'); | 17 | $crawler = $client->request('GET', '/developer/client/create'); |
18 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 18 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
19 | 19 | ||
20 | $form = $crawler->filter('button[type=submit]')->form(); | 20 | $form = $crawler->filter('button[type=submit]')->form(); |
21 | 21 | ||
@@ -25,7 +25,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
25 | 25 | ||
26 | $crawler = $client->submit($form, $data); | 26 | $crawler = $client->submit($form, $data); |
27 | 27 | ||
28 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 28 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
29 | 29 | ||
30 | $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); | 30 | $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); |
31 | $this->assertGreaterThan(count($nbClients), count($newNbClients)); | 31 | $this->assertGreaterThan(count($nbClients), count($newNbClients)); |
@@ -47,7 +47,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
47 | 'password' => 'mypassword', | 47 | 'password' => 'mypassword', |
48 | ]); | 48 | ]); |
49 | 49 | ||
50 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 50 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
51 | 51 | ||
52 | $data = json_decode($client->getResponse()->getContent(), true); | 52 | $data = json_decode($client->getResponse()->getContent(), true); |
53 | $this->assertArrayHasKey('access_token', $data); | 53 | $this->assertArrayHasKey('access_token', $data); |
@@ -67,7 +67,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
67 | 'client_secret' => $apiClient->getSecret(), | 67 | 'client_secret' => $apiClient->getSecret(), |
68 | ]); | 68 | ]); |
69 | 69 | ||
70 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 70 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
71 | 71 | ||
72 | $data = json_decode($client->getResponse()->getContent(), true); | 72 | $data = json_decode($client->getResponse()->getContent(), true); |
73 | $this->assertArrayHasKey('access_token', $data); | 73 | $this->assertArrayHasKey('access_token', $data); |
@@ -84,8 +84,8 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
84 | $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); | 84 | $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); |
85 | 85 | ||
86 | $crawler = $client->request('GET', '/developer'); | 86 | $crawler = $client->request('GET', '/developer'); |
87 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 87 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
88 | $this->assertEquals(count($nbClients), $crawler->filter('ul[class=collapsible] li')->count()); | 88 | $this->assertSame(count($nbClients), $crawler->filter('ul[class=collapsible] li')->count()); |
89 | } | 89 | } |
90 | 90 | ||
91 | public function testDeveloperHowto() | 91 | public function testDeveloperHowto() |
@@ -94,7 +94,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
94 | $client = $this->getClient(); | 94 | $client = $this->getClient(); |
95 | 95 | ||
96 | $crawler = $client->request('GET', '/developer/howto/first-app'); | 96 | $crawler = $client->request('GET', '/developer/howto/first-app'); |
97 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 97 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
98 | } | 98 | } |
99 | 99 | ||
100 | public function testRemoveClient() | 100 | public function testRemoveClient() |
@@ -109,8 +109,8 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
109 | $this->assertContains('no_client', $client->getResponse()->getContent()); | 109 | $this->assertContains('no_client', $client->getResponse()->getContent()); |
110 | 110 | ||
111 | $this->logInAs('bob'); | 111 | $this->logInAs('bob'); |
112 | $client->request('GET', '/developer/client/delete/'.$adminApiClient->getId()); | 112 | $client->request('GET', '/developer/client/delete/' . $adminApiClient->getId()); |
113 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); | 113 | $this->assertSame(403, $client->getResponse()->getStatusCode()); |
114 | 114 | ||
115 | // Try to remove the admin's client with the good user | 115 | // Try to remove the admin's client with the good user |
116 | $this->logInAs('admin'); | 116 | $this->logInAs('admin'); |
@@ -123,7 +123,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
123 | ; | 123 | ; |
124 | 124 | ||
125 | $client->click($link); | 125 | $client->click($link); |
126 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 126 | $this->assertSame(302, $client->getResponse()->getStatusCode()); |
127 | 127 | ||
128 | $this->assertNull( | 128 | $this->assertNull( |
129 | $em->getRepository('WallabagApiBundle:Client')->find($adminApiClient->getId()), | 129 | $em->getRepository('WallabagApiBundle:Client')->find($adminApiClient->getId()), |
@@ -133,8 +133,8 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
133 | 133 | ||
134 | /** | 134 | /** |
135 | * @param string $username | 135 | * @param string $username |
136 | * @param array $grantTypes | ||
136 | * | 137 | * |
137 | * @param array $grantTypes | ||
138 | * @return Client | 138 | * @return Client |
139 | */ | 139 | */ |
140 | private function createApiClientForUser($username, $grantTypes = ['password']) | 140 | private function createApiClientForUser($username, $grantTypes = ['password']) |
@@ -142,7 +142,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
142 | $client = $this->getClient(); | 142 | $client = $this->getClient(); |
143 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); | 143 | $em = $client->getContainer()->get('doctrine.orm.entity_manager'); |
144 | $userManager = $client->getContainer()->get('fos_user.user_manager'); | 144 | $userManager = $client->getContainer()->get('fos_user.user_manager'); |
145 | $user = $userManager->findUserBy(array('username' => $username)); | 145 | $user = $userManager->findUserBy(['username' => $username]); |
146 | $apiClient = new Client($user); | 146 | $apiClient = new Client($user); |
147 | $apiClient->setName('My app'); | 147 | $apiClient->setName('My app'); |
148 | $apiClient->setAllowedGrantTypes($grantTypes); | 148 | $apiClient->setAllowedGrantTypes($grantTypes); |