aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-04-25 14:12:56 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-04-26 12:53:21 +0200
commitf277bc042c8e805aab14b31b5b51e2878d80c6f4 (patch)
treeaf75f475af7bb2d0f8c3a44a404f90e2d93dfa2b /tests/Wallabag/CoreBundle
parent531c8d0a5c55fa93438e227a7d349235fbd31d28 (diff)
downloadwallabag-f277bc042c8e805aab14b31b5b51e2878d80c6f4.tar.gz
wallabag-f277bc042c8e805aab14b31b5b51e2878d80c6f4.tar.zst
wallabag-f277bc042c8e805aab14b31b5b51e2878d80c6f4.zip
Fix tests & cs & migration
Diffstat (limited to 'tests/Wallabag/CoreBundle')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php54
-rw-r--r--tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php6
4 files changed, 32 insertions, 32 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 28291b5a..caa8929d 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -166,7 +166,7 @@ class EntryControllerTest extends WallabagCoreTestCase
166 $this->assertSame($this->url, $content->getUrl()); 166 $this->assertSame($this->url, $content->getUrl());
167 $this->assertContains('Google', $content->getTitle()); 167 $this->assertContains('Google', $content->getTitle());
168 $this->assertSame('fr', $content->getLanguage()); 168 $this->assertSame('fr', $content->getLanguage());
169 $this->assertSame('2016-04-07 19:01:35', $content->getPublishedAt()->format('Y-m-d H:i:s')); 169 $this->assertSame('2015-03-28 11:43:19', $content->getPublishedAt()->format('Y-m-d H:i:s'));
170 $this->assertArrayHasKey('x-frame-options', $content->getHeaders()); 170 $this->assertArrayHasKey('x-frame-options', $content->getHeaders());
171 $client->getContainer()->get('craue_config')->set('store_article_headers', 0); 171 $client->getContainer()->get('craue_config')->set('store_article_headers', 0);
172 } 172 }
diff --git a/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php b/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php
index 7442e8a4..70f33ebe 100644
--- a/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php
@@ -11,48 +11,48 @@ class FeedControllerTest extends WallabagCoreTestCase
11 $doc = new \DOMDocument(); 11 $doc = new \DOMDocument();
12 $doc->loadXML($xml); 12 $doc->loadXML($xml);
13 13
14 $xpath = new \DOMXpath($doc); 14 $xpath = new \DOMXPath($doc);
15 $xpath->registerNamespace('a', 'http://www.w3.org/2005/Atom'); 15 $xpath->registerNamespace('a', 'http://www.w3.org/2005/Atom');
16 16
17 if (null === $nb) { 17 if (null === $nb) {
18 $this->assertGreaterThan(0, $xpath->query('//a:entry')->length); 18 $this->assertGreaterThan(0, $xpath->query('//a:entry')->length);
19 } else { 19 } else {
20 $this->assertEquals($nb, $xpath->query('//a:entry')->length); 20 $this->assertSame($nb, $xpath->query('//a:entry')->length);
21 } 21 }
22 22
23 $this->assertEquals(1, $xpath->query('/a:feed')->length); 23 $this->assertSame(1, $xpath->query('/a:feed')->length);
24 24
25 $this->assertEquals(1, $xpath->query('/a:feed/a:title')->length); 25 $this->assertSame(1, $xpath->query('/a:feed/a:title')->length);
26 $this->assertContains('favicon.ico', $xpath->query('/a:feed/a:icon')->item(0)->nodeValue); 26 $this->assertContains('favicon.ico', $xpath->query('/a:feed/a:icon')->item(0)->nodeValue);
27 $this->assertContains('logo-square.png', $xpath->query('/a:feed/a:logo')->item(0)->nodeValue); 27 $this->assertContains('logo-square.png', $xpath->query('/a:feed/a:logo')->item(0)->nodeValue);
28 28
29 $this->assertEquals(1, $xpath->query('/a:feed/a:updated')->length); 29 $this->assertSame(1, $xpath->query('/a:feed/a:updated')->length);
30 30
31 $this->assertEquals(1, $xpath->query('/a:feed/a:generator')->length); 31 $this->assertSame(1, $xpath->query('/a:feed/a:generator')->length);
32 $this->assertEquals('wallabag', $xpath->query('/a:feed/a:generator')->item(0)->nodeValue); 32 $this->assertSame('wallabag', $xpath->query('/a:feed/a:generator')->item(0)->nodeValue);
33 $this->assertEquals('admin', $xpath->query('/a:feed/a:author/a:name')->item(0)->nodeValue); 33 $this->assertSame('admin', $xpath->query('/a:feed/a:author/a:name')->item(0)->nodeValue);
34 34
35 $this->assertEquals(1, $xpath->query('/a:feed/a:subtitle')->length); 35 $this->assertSame(1, $xpath->query('/a:feed/a:subtitle')->length);
36 if (null !== $tagValue && 0 === strpos($type, 'tag')) { 36 if (null !== $tagValue && 0 === strpos($type, 'tag')) {
37 $this->assertEquals('wallabag — '.$type.' '.$tagValue.' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue); 37 $this->assertSame('wallabag — ' . $type . ' ' . $tagValue . ' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue);
38 $this->assertEquals('Atom feed for entries tagged with ' . $tagValue, $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue); 38 $this->assertSame('Atom feed for entries tagged with ' . $tagValue, $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue);
39 } else { 39 } else {
40 $this->assertEquals('wallabag — '.$type.' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue); 40 $this->assertSame('wallabag — ' . $type . ' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue);
41 $this->assertEquals('Atom feed for ' . $type . ' entries', $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue); 41 $this->assertSame('Atom feed for ' . $type . ' entries', $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue);
42 } 42 }
43 43
44 $this->assertEquals(1, $xpath->query('/a:feed/a:link[@rel="self"]')->length); 44 $this->assertSame(1, $xpath->query('/a:feed/a:link[@rel="self"]')->length);
45 $this->assertContains($type, $xpath->query('/a:feed/a:link[@rel="self"]')->item(0)->getAttribute('href')); 45 $this->assertContains($type, $xpath->query('/a:feed/a:link[@rel="self"]')->item(0)->getAttribute('href'));
46 46
47 $this->assertEquals(1, $xpath->query('/a:feed/a:link[@rel="last"]')->length); 47 $this->assertSame(1, $xpath->query('/a:feed/a:link[@rel="last"]')->length);
48 48
49 foreach ($xpath->query('//a:entry') as $item) { 49 foreach ($xpath->query('//a:entry') as $item) {
50 $this->assertEquals(1, $xpath->query('a:title', $item)->length); 50 $this->assertSame(1, $xpath->query('a:title', $item)->length);
51 $this->assertEquals(1, $xpath->query('a:link[@rel="via"]', $item)->length); 51 $this->assertSame(1, $xpath->query('a:link[@rel="via"]', $item)->length);
52 $this->assertEquals(1, $xpath->query('a:link[@rel="alternate"]', $item)->length); 52 $this->assertSame(1, $xpath->query('a:link[@rel="alternate"]', $item)->length);
53 $this->assertEquals(1, $xpath->query('a:id', $item)->length); 53 $this->assertSame(1, $xpath->query('a:id', $item)->length);
54 $this->assertEquals(1, $xpath->query('a:published', $item)->length); 54 $this->assertSame(1, $xpath->query('a:published', $item)->length);
55 $this->assertEquals(1, $xpath->query('a:content', $item)->length); 55 $this->assertSame(1, $xpath->query('a:content', $item)->length);
56 } 56 }
57 } 57 }
58 58
@@ -190,15 +190,15 @@ class FeedControllerTest extends WallabagCoreTestCase
190 $client = $this->getClient(); 190 $client = $this->getClient();
191 191
192 $client->request('GET', '/feed/admin/SUPERTOKEN/unread'); 192 $client->request('GET', '/feed/admin/SUPERTOKEN/unread');
193 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 193 $this->assertSame(200, $client->getResponse()->getStatusCode());
194 $this->validateDom($client->getResponse()->getContent(), 'unread'); 194 $this->validateDom($client->getResponse()->getContent(), 'unread');
195 195
196 $client->request('GET', '/feed/admin/SUPERTOKEN/unread/2'); 196 $client->request('GET', '/feed/admin/SUPERTOKEN/unread/2');
197 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 197 $this->assertSame(200, $client->getResponse()->getStatusCode());
198 $this->validateDom($client->getResponse()->getContent(), 'unread'); 198 $this->validateDom($client->getResponse()->getContent(), 'unread');
199 199
200 $client->request('GET', '/feed/admin/SUPERTOKEN/unread/3000'); 200 $client->request('GET', '/feed/admin/SUPERTOKEN/unread/3000');
201 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 201 $this->assertSame(302, $client->getResponse()->getStatusCode());
202 } 202 }
203 203
204 public function testTags() 204 public function testTags()
@@ -216,13 +216,13 @@ class FeedControllerTest extends WallabagCoreTestCase
216 $em->flush(); 216 $em->flush();
217 217
218 $client = $this->getClient(); 218 $client = $this->getClient();
219 $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml'); 219 $client->request('GET', '/feed/admin/SUPERTOKEN/tags/foo');
220 220
221 $this->assertSame(200, $client->getResponse()->getStatusCode()); 221 $this->assertSame(200, $client->getResponse()->getStatusCode());
222 222
223 $this->validateDom($client->getResponse()->getContent(), 'tag', 2, 'foo-bar'); 223 $this->validateDom($client->getResponse()->getContent(), 'tag', 2, 'foo');
224 224
225 $client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml?page=3000'); 225 $client->request('GET', '/feed/admin/SUPERTOKEN/tags/foo/3000');
226 $this->assertSame(302, $client->getResponse()->getStatusCode()); 226 $this->assertSame(302, $client->getResponse()->getStatusCode());
227 } 227 }
228} 228}
diff --git a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php
index 3c3354d7..93019b1f 100644
--- a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php
@@ -13,7 +13,7 @@ class SecurityControllerTest extends WallabagCoreTestCase
13 $client->followRedirects(); 13 $client->followRedirects();
14 14
15 $crawler = $client->request('GET', '/config'); 15 $crawler = $client->request('GET', '/config');
16 $this->assertContains('config.form_rss.description', $crawler->filter('body')->extract(['_text'])[0]); 16 $this->assertContains('config.form_feed.description', $crawler->filter('body')->extract(['_text'])[0]);
17 } 17 }
18 18
19 public function testLoginWithout2Factor() 19 public function testLoginWithout2Factor()
diff --git a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php
index 3fd90fda..39fcec16 100644
--- a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php
+++ b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php
@@ -52,9 +52,9 @@ class WallabagExtensionTest extends TestCase
52 52
53 $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator); 53 $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator);
54 54
55 $this->assertEquals('lemonde.fr', $extension->removeScheme('lemonde.fr')); 55 $this->assertSame('lemonde.fr', $extension->removeScheme('lemonde.fr'));
56 $this->assertEquals('gist.github.com', $extension->removeScheme('gist.github.com')); 56 $this->assertSame('gist.github.com', $extension->removeScheme('gist.github.com'));
57 $this->assertEquals('gist.github.com', $extension->removeScheme('https://gist.github.com')); 57 $this->assertSame('gist.github.com', $extension->removeScheme('https://gist.github.com'));
58 } 58 }
59 59
60 public function testRemoveSchemeAndWww() 60 public function testRemoveSchemeAndWww()