diff options
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php | 54 |
1 files changed, 27 insertions, 27 deletions
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 | } |