add json & xml

This commit is contained in:
Thomas Citharel
2015-10-18 15:49:00 +02:00
committed by Nicolas Lœuillet
parent 33c36f6b48
commit b3cc1a14e7
4 changed files with 102 additions and 11 deletions

View 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'));
}
}