From b3cc1a14e7b9939fdaf7e71fac40ed7c42727854 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 18 Oct 2015 15:49:00 +0200 Subject: add json & xml --- .../Tests/Controller/ExportControllerTest.php | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/Wallabag/CoreBundle/Tests') diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php index 3f749aae..febdf4d4 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php @@ -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')); + } } -- cgit v1.2.3