aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2015-10-18 15:49:00 +0200
committerNicolas LÅ“uillet <nicolas.loeuillet@smile.fr>2015-11-09 16:32:48 +0100
commitb3cc1a14e7b9939fdaf7e71fac40ed7c42727854 (patch)
treee473e4c70a81167ded9de691a713b83894af9d72 /src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php
parent33c36f6b482dd512a43b86c0e965bc09a67cf555 (diff)
downloadwallabag-b3cc1a14e7b9939fdaf7e71fac40ed7c42727854.tar.gz
wallabag-b3cc1a14e7b9939fdaf7e71fac40ed7c42727854.tar.zst
wallabag-b3cc1a14e7b9939fdaf7e71fac40ed7c42727854.zip
add json & xml
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php34
1 files changed, 34 insertions, 0 deletions
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
113 $this->assertGreaterThan(1, $csv); 113 $this->assertGreaterThan(1, $csv);
114 $this->assertEquals('Title;URL;Content;Tags;"MIME Type";Language', $csv[0]); 114 $this->assertEquals('Title;URL;Content;Tags;"MIME Type";Language', $csv[0]);
115 } 115 }
116
117 public function testJsonExport()
118 {
119 $this->logInAs('admin');
120 $client = $this->getClient();
121
122 ob_start();
123 $crawler = $client->request('GET', '/export/all.json');
124 ob_end_clean();
125
126 $this->assertEquals(200, $client->getResponse()->getStatusCode());
127
128 $headers = $client->getResponse()->headers;
129 $this->assertEquals('application/json', $headers->get('content-type'));
130 $this->assertEquals('attachment; filename="All articles.json"', $headers->get('content-disposition'));
131 $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding'));
132 }
133
134 public function testXmlExport()
135 {
136 $this->logInAs('admin');
137 $client = $this->getClient();
138
139 ob_start();
140 $crawler = $client->request('GET', '/export/unread.xml');
141 ob_end_clean();
142
143 $this->assertEquals(200, $client->getResponse()->getStatusCode());
144
145 $headers = $client->getResponse()->headers;
146 $this->assertEquals('application/xml', $headers->get('content-type'));
147 $this->assertEquals('attachment; filename="Unread articles.xml"', $headers->get('content-disposition'));
148 $this->assertEquals('UTF-8', $headers->get('content-transfer-encoding'));
149 }
116} 150}