Fix export for same domain entries

This commit is contained in:
Nicolas Lœuillet
2023-06-29 17:10:23 +02:00
parent dc02c679d2
commit 6639f7da6d
3 changed files with 40 additions and 9 deletions

View File

@ -10,6 +10,8 @@ class ExportControllerTest extends WallabagCoreTestCase
{
private $adminEntry;
private $bobEntry;
private $sameDomainEntry;
private $sameDomainEntry2;
public function testLogin()
{
@ -326,6 +328,26 @@ class ExportControllerTest extends WallabagCoreTestCase
$this->assertNotEmpty('updated_at', (string) $content->entry[0]->updated_at);
}
public function testJsonExportFromSameDomain()
{
$this->logInAs('admin');
$client = $this->getTestClient();
ob_start();
$crawler = $client->request('GET', '/export/same_domain.json?entry=1');
ob_end_clean();
$this->assertSame(200, $client->getResponse()->getStatusCode());
$headers = $client->getResponse()->headers;
$this->assertSame('application/json', $headers->get('content-type'));
$this->assertSame('attachment; filename="Same domain articles.json"', $headers->get('content-disposition'));
$this->assertSame('UTF-8', $headers->get('content-transfer-encoding'));
$content = json_decode($client->getResponse()->getContent(), true);
$this->assertCount(4, $content);
}
private function setUpForJsonExportFromSearch()
{
$client = $this->getTestClient();