]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php
Add tests
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Tests / Controller / WallabagRestControllerTest.php
index b0f4a84254a26eaeea9452b7fd65a68726d0de81..0eca7cde6821407d7d51d107e7b6ef0b34653fb8 100644 (file)
@@ -44,10 +44,6 @@ class WallabagRestControllerTest extends WallabagTestCase
     public function testWithBadHeaders()
     {
         $client = $this->createClient();
-        $client->request('GET', '/api/salts/admin.json');
-        $salt = json_decode($client->getResponse()->getContent());
-
-        $headers = $this->generateHeaders('admin', 'mypassword', $salt[0]);
 
         $entry = $client->getContainer()
             ->get('doctrine.orm.entity_manager')
@@ -144,7 +140,7 @@ class WallabagRestControllerTest extends WallabagTestCase
         $client->request('GET', '/api/salts/admin.json');
         $salt = json_decode($client->getResponse()->getContent());
 
-        $headers = $this->generateHeaders('admin', 'test', $salt[0]);
+        $headers = $this->generateHeaders('admin', 'mypassword', $salt[0]);
 
         $client->request('DELETE', '/api/entries/'.$entry->getId().'.json', array(), array(), $headers);
 
@@ -156,13 +152,15 @@ class WallabagRestControllerTest extends WallabagTestCase
         $client = $this->createClient();
         $client->request('GET', '/api/salts/admin.json');
         $salt = json_decode($client->getResponse()->getContent());
-        $headers = $this->generateHeaders('admin', 'test', $salt[0]);
+        $headers = $this->generateHeaders('admin', 'mypassword', $salt[0]);
 
         $entry = $client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
             ->findOneWithTags(1);
 
+        $entry = $entry[0];
+
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
         }
@@ -174,7 +172,7 @@ class WallabagRestControllerTest extends WallabagTestCase
 
         $client->request('GET', '/api/entries/'.$entry->getId().'/tags', array(), array(), $headers);
 
-        $this->assertEquals(json_encode($tags), $client->getResponse()->getContent());
+        $this->assertEquals(json_encode($tags, JSON_HEX_QUOT), $client->getResponse()->getContent());
     }
 
     public function testPostTagsOnEntry()
@@ -182,7 +180,7 @@ class WallabagRestControllerTest extends WallabagTestCase
         $client = $this->createClient();
         $client->request('GET', '/api/salts/admin.json');
         $salt = json_decode($client->getResponse()->getContent());
-        $headers = $this->generateHeaders('admin', 'test', $salt[0]);
+        $headers = $this->generateHeaders('admin', 'mypassword', $salt[0]);
 
         $entry = $client->getContainer()
             ->get('doctrine.orm.entity_manager')