aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2019-01-11 13:34:38 +0100
committerGitHub <noreply@github.com>2019-01-11 13:34:38 +0100
commit3625833b2c0bce7a37ec2bd873e6bbb0b76c4a4e (patch)
treea13bd3b3191c63823e5e300cf4068d6d5e573f43 /tests
parent03663530edf0512cc337518d794bd3c71ebdde96 (diff)
parent5e1f27767bc2dcf0760bc3061544ecbb833ad5e7 (diff)
downloadwallabag-3625833b2c0bce7a37ec2bd873e6bbb0b76c4a4e.tar.gz
wallabag-3625833b2c0bce7a37ec2bd873e6bbb0b76c4a4e.tar.zst
wallabag-3625833b2c0bce7a37ec2bd873e6bbb0b76c4a4e.zip
Merge pull request #3826 from wallabag/epub-toc
Rework of EPUB/PDF exports
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
index 6f3308e5..0c3d4c83 100644
--- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
@@ -98,7 +98,7 @@ class ExportControllerTest extends WallabagCoreTestCase
98 98
99 $headers = $client->getResponse()->headers; 99 $headers = $client->getResponse()->headers;
100 $this->assertSame('application/x-mobipocket-ebook', $headers->get('content-type')); 100 $this->assertSame('application/x-mobipocket-ebook', $headers->get('content-type'));
101 $this->assertSame('attachment; filename="' . preg_replace('/[^A-Za-z0-9\-]/', '', $content->getTitle()) . '.mobi"', $headers->get('content-disposition')); 101 $this->assertSame('attachment; filename="' . $this->getSanitizedFilename($content->getTitle()) . '.mobi"', $headers->get('content-disposition'));
102 $this->assertSame('binary', $headers->get('content-transfer-encoding')); 102 $this->assertSame('binary', $headers->get('content-transfer-encoding'));
103 } 103 }
104 104
@@ -126,7 +126,7 @@ class ExportControllerTest extends WallabagCoreTestCase
126 126
127 $headers = $client->getResponse()->headers; 127 $headers = $client->getResponse()->headers;
128 $this->assertSame('application/pdf', $headers->get('content-type')); 128 $this->assertSame('application/pdf', $headers->get('content-type'));
129 $this->assertSame('attachment; filename="Tag_entries articles.pdf"', $headers->get('content-disposition')); 129 $this->assertSame('attachment; filename="Tag foo bar articles.pdf"', $headers->get('content-disposition'));
130 $this->assertSame('binary', $headers->get('content-transfer-encoding')); 130 $this->assertSame('binary', $headers->get('content-transfer-encoding'));
131 } 131 }
132 132
@@ -212,7 +212,7 @@ class ExportControllerTest extends WallabagCoreTestCase
212 212
213 $headers = $client->getResponse()->headers; 213 $headers = $client->getResponse()->headers;
214 $this->assertSame('application/json', $headers->get('content-type')); 214 $this->assertSame('application/json', $headers->get('content-type'));
215 $this->assertSame('attachment; filename="' . $contentInDB->getTitle() . '.json"', $headers->get('content-disposition')); 215 $this->assertSame('attachment; filename="' . $this->getSanitizedFilename($contentInDB->getTitle()) . '.json"', $headers->get('content-disposition'));
216 $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); 216 $this->assertSame('UTF-8', $headers->get('content-transfer-encoding'));
217 217
218 $content = json_decode($client->getResponse()->getContent(), true); 218 $content = json_decode($client->getResponse()->getContent(), true);
@@ -281,4 +281,9 @@ class ExportControllerTest extends WallabagCoreTestCase
281 $this->assertNotEmpty('created_at', (string) $content->entry[0]->created_at); 281 $this->assertNotEmpty('created_at', (string) $content->entry[0]->created_at);
282 $this->assertNotEmpty('updated_at', (string) $content->entry[0]->updated_at); 282 $this->assertNotEmpty('updated_at', (string) $content->entry[0]->updated_at);
283 } 283 }
284
285 private function getSanitizedFilename($title)
286 {
287 return preg_replace('/[^A-Za-z0-9\- \']/', '', iconv('utf-8', 'us-ascii//TRANSLIT', $title));
288 }
284} 289}