]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php
add json & xml
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Tests / Controller / ExportControllerTest.php
index 3f749aaeec08138db145c50f0ecf7d7811feafec..febdf4d4ca2db38a84f4aae8e73f8cb104435706 100644 (file)
@@ -113,4 +113,38 @@ class ExportControllerTest extends WallabagCoreTestCase
         $this->assertGreaterThan(1, $csv);
         $this->assertEquals('Title;URL;Content;Tags;"MIME Type";Language', $csv[0]);
     }
+
+    public function testJsonExport()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        ob_start();
+        $crawler = $client->request('GET', '/export/all.json');
+        ob_end_clean();
+
+        $this->assertEquals(200, $client->getResponse()->getStatusCode());
+
+        $headers = $client->getResponse()->headers;
+        $this->assertEquals('application/json', $headers->get('content-type'));
+        $this->assertEquals('attachment; filename="All articles.json"', $headers->get('content-disposition'));
+        $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding'));
+    }
+
+    public function testXmlExport()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        ob_start();
+        $crawler = $client->request('GET', '/export/unread.xml');
+        ob_end_clean();
+
+        $this->assertEquals(200, $client->getResponse()->getStatusCode());
+
+        $headers = $client->getResponse()->headers;
+        $this->assertEquals('application/xml', $headers->get('content-type'));
+        $this->assertEquals('attachment; filename="Unread articles.xml"', $headers->get('content-disposition'));
+        $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding'));
+    }
 }