aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/ApiBundle/Tests')
-rw-r--r--src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php7
-rw-r--r--src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php9
2 files changed, 14 insertions, 2 deletions
diff --git a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php
index a7120e83..22894a77 100644
--- a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php
+++ b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php
@@ -310,5 +310,12 @@ class WallabagRestControllerTest extends WallabagApiTestCase
310 $this->assertArrayHasKey('label', $content); 310 $this->assertArrayHasKey('label', $content);
311 $this->assertEquals($tag['label'], $content['label']); 311 $this->assertEquals($tag['label'], $content['label']);
312 $this->assertEquals($tag['slug'], $content['slug']); 312 $this->assertEquals($tag['slug'], $content['slug']);
313
314 $entries = $entry = $this->client->getContainer()
315 ->get('doctrine.orm.entity_manager')
316 ->getRepository('WallabagCoreBundle:Entry')
317 ->findAllByTagId($this->user->getId(), $tag['id']);
318
319 $this->assertCount(0, $entries);
313 } 320 }
314} 321}
diff --git a/src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php b/src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php
index 8a57fea2..a415c749 100644
--- a/src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php
+++ b/src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php
@@ -12,6 +12,11 @@ abstract class WallabagApiTestCase extends WebTestCase
12 */ 12 */
13 protected $client = null; 13 protected $client = null;
14 14
15 /**
16 * @var \FOS\UserBundle\Model\UserInterface
17 */
18 protected $user;
19
15 public function setUp() 20 public function setUp()
16 { 21 {
17 $this->client = $this->createAuthorizedClient(); 22 $this->client = $this->createAuthorizedClient();
@@ -31,8 +36,8 @@ abstract class WallabagApiTestCase extends WebTestCase
31 $loginManager = $container->get('fos_user.security.login_manager'); 36 $loginManager = $container->get('fos_user.security.login_manager');
32 $firewallName = $container->getParameter('fos_user.firewall_name'); 37 $firewallName = $container->getParameter('fos_user.firewall_name');
33 38
34 $user = $userManager->findUserBy(array('username' => 'admin')); 39 $this->user = $userManager->findUserBy(array('username' => 'admin'));
35 $loginManager->loginUser($firewallName, $user); 40 $loginManager->loginUser($firewallName, $this->user);
36 41
37 // save the login token into the session and put it in a cookie 42 // save the login token into the session and put it in a cookie
38 $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); 43 $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken()));