aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
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}