aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
index f58d1c12..e3d69290 100644
--- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
@@ -30,7 +30,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
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));
32 32
33 $this->assertGreaterThan(1, $alert = $crawler->filter('.settings ul li strong')->extract(['_text'])); 33 $this->assertGreaterThan(1, $alert = $crawler->filter('.settings table strong')->extract(['_text']));
34 $this->assertContains('My app', $alert[0]); 34 $this->assertContains('My app', $alert[0]);
35 } 35 }
36 36
@@ -56,6 +56,20 @@ class DeveloperControllerTest extends WallabagCoreTestCase
56 $this->assertArrayHasKey('refresh_token', $data); 56 $this->assertArrayHasKey('refresh_token', $data);
57 } 57 }
58 58
59 public function testCreateTokenWithBadClientId()
60 {
61 $client = $this->getClient();
62 $client->request('POST', '/oauth/v2/token', [
63 'grant_type' => 'password',
64 'client_id' => '$WALLABAG_CLIENT_ID',
65 'client_secret' => 'secret',
66 'username' => 'admin',
67 'password' => 'mypassword',
68 ]);
69
70 $this->assertSame(400, $client->getResponse()->getStatusCode());
71 }
72
59 public function testListingClient() 73 public function testListingClient()
60 { 74 {
61 $this->logInAs('admin'); 75 $this->logInAs('admin');
@@ -121,7 +135,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
121 { 135 {
122 $client = $this->getClient(); 136 $client = $this->getClient();
123 $em = $client->getContainer()->get('doctrine.orm.entity_manager'); 137 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
124 $userManager = $client->getContainer()->get('fos_user.user_manager'); 138 $userManager = $client->getContainer()->get('fos_user.user_manager.test');
125 $user = $userManager->findUserBy(['username' => $username]); 139 $user = $userManager->findUserBy(['username' => $username]);
126 $apiClient = new Client($user); 140 $apiClient = new Client($user);
127 $apiClient->setName('My app'); 141 $apiClient->setName('My app');