aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pt.yml6
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml1
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml1
-rw-r--r--docs/de/user/configuration.rst3
-rw-r--r--docs/en/user/configuration.rst3
-rw-r--r--docs/fr/user/configuration.rst3
-rw-r--r--src/Wallabag/CoreBundle/Controller/RssController.php36
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig10
-rw-r--r--tests/Wallabag/CoreBundle/Controller/RssControllerTest.php53
18 files changed, 112 insertions, 13 deletions
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml
index 8ee0a303..fac3b4f8 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml
@@ -1,3 +1,4 @@
1# settings_changed: Configuration updated
1download_pictures: Download billeder på din server 2download_pictures: Download billeder på din server
2carrot: Aktiver deling til Carrot 3carrot: Aktiver deling til Carrot
3diaspora_url: Diaspora URL, hvis tjenesten er aktiv 4diaspora_url: Diaspora URL, hvis tjenesten er aktiv
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml
index 73a9d640..d382733c 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml
@@ -1,3 +1,4 @@
1# settings_changed: Configuration updated
1download_pictures: Bilder auf den Server herunterladen 2download_pictures: Bilder auf den Server herunterladen
2carrot: Teilen zu Carrot aktivieren 3carrot: Teilen zu Carrot aktivieren
3diaspora_url: Diaspora-URL, sofern der Service aktiviert ist 4diaspora_url: Diaspora-URL, sofern der Service aktiviert ist
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
index c8c13805..23de7a43 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
@@ -1,3 +1,4 @@
1settings_changed: Configuration updated
1download_pictures: Download pictures on your server 2download_pictures: Download pictures on your server
2carrot: Enable share to Carrot 3carrot: Enable share to Carrot
3diaspora_url: Diaspora URL, if the service is enabled 4diaspora_url: Diaspora URL, if the service is enabled
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml
index 0ea98d8f..ff1dd04f 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml
@@ -1,3 +1,4 @@
1# settings_changed: Configuration updated
1download_pictures: Descargar imágenes 2download_pictures: Descargar imágenes
2carrot: Activar compartir con Carrot 3carrot: Activar compartir con Carrot
3diaspora_url: Diaspora URL, si el servicio está activado 4diaspora_url: Diaspora URL, si el servicio está activado
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml
index c527b971..4e712fdd 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml
@@ -1,3 +1,4 @@
1# settings_changed: Configuration updated
1download_pictures: تصاویر را در کارگزار خودتان باربگیرید 2download_pictures: تصاویر را در کارگزار خودتان باربگیرید
2carrot: فعال‌سازی هم‌رسانی به Carrot 3carrot: فعال‌سازی هم‌رسانی به Carrot
3diaspora_url: نشانی Diaspora، اگر فعال بود 4diaspora_url: نشانی Diaspora، اگر فعال بود
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
index 176e7c86..cae4c662 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
@@ -1,3 +1,4 @@
1settings_changed: Configuration mise à jour
1download_pictures: Télécharger les images sur le serveur 2download_pictures: Télécharger les images sur le serveur
2carrot: Activer le partage vers Carrot 3carrot: Activer le partage vers Carrot
3diaspora_url: URL de Diaspora, si le service Diaspora est activé 4diaspora_url: URL de Diaspora, si le service Diaspora est activé
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml
index 621d4dcd..f94f834f 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml
@@ -1,3 +1,4 @@
1# settings_changed: Configuration updated
1download_pictures: Scarica le immagini sul tuo server 2download_pictures: Scarica le immagini sul tuo server
2carrot: Abilita la condivisione con Carrot 3carrot: Abilita la condivisione con Carrot
3diaspora_url: Diaspora URL, se il servizio è abilitato 4diaspora_url: Diaspora URL, se il servizio è abilitato
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml
index 04accd45..de60a194 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml
@@ -1,3 +1,4 @@
1# settings_changed: Configuration updated
1download_pictures: Telecargar los imatges sul servidor 2download_pictures: Telecargar los imatges sul servidor
2carrot: Activar lo partatge cap a Carrot 3carrot: Activar lo partatge cap a Carrot
3diaspora_url: URL de Diaspora, se lo servici Diaspora es activat 4diaspora_url: URL de Diaspora, se lo servici Diaspora es activat
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml
index 2f4f3154..11579745 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml
@@ -1,3 +1,4 @@
1# settings_changed: Configuration updated
1download_pictures: Pobierz obrazy na swój serwer 2download_pictures: Pobierz obrazy na swój serwer
2carrot: Włącz udostępnianie dla Carrot 3carrot: Włącz udostępnianie dla Carrot
3diaspora_url: Adres URL Diaspora, jeżeli usługa jest włączona 4diaspora_url: Adres URL Diaspora, jeżeli usługa jest włączona
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pt.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pt.yml
index 5da940e9..74ae5a44 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pt.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pt.yml
@@ -1,3 +1,4 @@
1# settings_changed: Configuration updated
1download_pictures: Download imagens no seu servidor 2download_pictures: Download imagens no seu servidor
2carrot: Habilitar compartilhamento para o Carrot 3carrot: Habilitar compartilhamento para o Carrot
3diaspora_url: URL Diaspora, se o serviço está habilitado 4diaspora_url: URL Diaspora, se o serviço está habilitado
@@ -8,7 +9,8 @@ export_csv: Habilita exportação para CSV
8export_json: Habilita exportação para JSON 9export_json: Habilita exportação para JSON
9export_txt: Habilita exportação para TXT 10export_txt: Habilita exportação para TXT
10export_xml: Habilita exportação para XML 11export_xml: Habilita exportação para XML
11pocket_consumer_key: Chave de consumidor do Pocket para importar conteúdo (https://getpocket.com/developer/docs/authentication) 12# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
13# import_with_redis: Enable Redis to import data asynchronously
12shaarli_url: URL Shaarli, se o serviço está habilitado 14shaarli_url: URL Shaarli, se o serviço está habilitado
13share_diaspora: Habilitar compartilhamento para o Diaspora 15share_diaspora: Habilitar compartilhamento para o Diaspora
14share_mail: Habilitar compartilhamento por e-mail 16share_mail: Habilitar compartilhamento por e-mail
@@ -28,3 +30,5 @@ piwik_site_id: ID de seu website Piwik
28piwik_enabled: Habilitar Piwik 30piwik_enabled: Habilitar Piwik
29demo_mode_enabled: "Habilitar modo demo? (somente usado para o demo público do wallabag)" 31demo_mode_enabled: "Habilitar modo demo? (somente usado para o demo público do wallabag)"
30demo_mode_username: "Usuário demo" 32demo_mode_username: "Usuário demo"
33# share_public: Allow public url for entries
34# download_images_enabled: Download images locally
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml
index 6d2eaffd..5095dfa0 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml
@@ -1,3 +1,4 @@
1# settings_changed: Configuration updated
1download_pictures: Descarcă poze pe server 2download_pictures: Descarcă poze pe server
2carrot: Permite share către Carrot 3carrot: Permite share către Carrot
3diaspora_url: Diaspora URL, dacă serviciul este permis 4diaspora_url: Diaspora URL, dacă serviciul este permis
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml
index 9146bfb6..cd42e595 100644
--- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml
@@ -1,3 +1,4 @@
1# settings_changed: Configuration updated
1# download_pictures: Download pictures on your server 2# download_pictures: Download pictures on your server
2# carrot: Enable share to Carrot 3# carrot: Enable share to Carrot
3# diaspora_url: Diaspora URL, if the service is enabled 4# diaspora_url: Diaspora URL, if the service is enabled
diff --git a/docs/de/user/configuration.rst b/docs/de/user/configuration.rst
index c0a8cd67..47c60f4c 100644
--- a/docs/de/user/configuration.rst
+++ b/docs/de/user/configuration.rst
@@ -52,6 +52,9 @@ Jetzt hast du drei Links, einen für jeden Status: Füge sie in deinem liebsten
52 52
53Du kannst auch definieren wie viele Artikel du in deinem RSS Feed (Standardwert: 50) haben willst. 53Du kannst auch definieren wie viele Artikel du in deinem RSS Feed (Standardwert: 50) haben willst.
54 54
55There is also a pagination available for these feeds. You can add ``?page=2`` to jump to the second page.
56The pagination follow `the RFC <https://tools.ietf.org/html/rfc5005#page-4>`_ about that, which means you'll find the ``next``, ``previous`` & ``last`` page link inside the `<channel>` tag of each RSS feed.
57
55Benutzer-Informationen 58Benutzer-Informationen
56---------------------- 59----------------------
57 60
diff --git a/docs/en/user/configuration.rst b/docs/en/user/configuration.rst
index a52d3ddd..caca834f 100644
--- a/docs/en/user/configuration.rst
+++ b/docs/en/user/configuration.rst
@@ -52,6 +52,9 @@ Now you have three links, one for each status: add them into your favourite RSS
52 52
53You can also define how many articles you want in each RSS feed (default value: 50). 53You can also define how many articles you want in each RSS feed (default value: 50).
54 54
55There is also a pagination available for these feeds. You can add ``?page=2`` to jump to the second page.
56The pagination follow `the RFC <https://tools.ietf.org/html/rfc5005#page-4>`_ about that, which means you'll find the ``next``, ``previous`` & ``last`` page link inside the `<channel>` tag of each RSS feed.
57
55User information 58User information
56---------------- 59----------------
57 60
diff --git a/docs/fr/user/configuration.rst b/docs/fr/user/configuration.rst
index 5ce80f58..025b05bb 100644
--- a/docs/fr/user/configuration.rst
+++ b/docs/fr/user/configuration.rst
@@ -53,6 +53,9 @@ Vous avez maintenant trois liens, un par statut : ajoutez-les dans votre agrég
53Vous pouvez aussi définir combien d'articles vous souhaitez dans vos flux RSS 53Vous pouvez aussi définir combien d'articles vous souhaitez dans vos flux RSS
54(50 est la valeur par défaut). 54(50 est la valeur par défaut).
55 55
56Une pagination est aussi disponible pour ces flux. Il suffit de rajouter ``?page=2`` pour aller à la seconde page, par exemple.
57Cette pagination suit `la RFC <https://tools.ietf.org/html/rfc5005#page-4>`_, ce qui signifie que vous trouverez la page suivante (``next``), précédente (``previous``) et la dernière (``last``) dans la balise `<channel>` de chaque flux RSS.
58
56Mon compte 59Mon compte
57---------- 60----------
58 61
diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php
index 38e3b5a0..2290386f 100644
--- a/src/Wallabag/CoreBundle/Controller/RssController.php
+++ b/src/Wallabag/CoreBundle/Controller/RssController.php
@@ -3,12 +3,15 @@
3namespace Wallabag\CoreBundle\Controller; 3namespace Wallabag\CoreBundle\Controller;
4 4
5use Pagerfanta\Adapter\DoctrineORMAdapter; 5use Pagerfanta\Adapter\DoctrineORMAdapter;
6use Pagerfanta\Exception\OutOfRangeCurrentPageException;
6use Pagerfanta\Pagerfanta; 7use Pagerfanta\Pagerfanta;
7use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; 8use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
8use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; 9use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
10use Symfony\Component\HttpFoundation\Request;
9use Symfony\Bundle\FrameworkBundle\Controller\Controller; 11use Symfony\Bundle\FrameworkBundle\Controller\Controller;
10use Wallabag\CoreBundle\Entity\Entry; 12use Wallabag\CoreBundle\Entity\Entry;
11use Wallabag\UserBundle\Entity\User; 13use Wallabag\UserBundle\Entity\User;
14use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
12 15
13class RssController extends Controller 16class RssController extends Controller
14{ 17{
@@ -20,9 +23,9 @@ class RssController extends Controller
20 * 23 *
21 * @return \Symfony\Component\HttpFoundation\Response 24 * @return \Symfony\Component\HttpFoundation\Response
22 */ 25 */
23 public function showUnreadAction(User $user) 26 public function showUnreadAction(Request $request, User $user)
24 { 27 {
25 return $this->showEntries('unread', $user); 28 return $this->showEntries('unread', $user, $request->query->get('page', 1));
26 } 29 }
27 30
28 /** 31 /**
@@ -33,9 +36,9 @@ class RssController extends Controller
33 * 36 *
34 * @return \Symfony\Component\HttpFoundation\Response 37 * @return \Symfony\Component\HttpFoundation\Response
35 */ 38 */
36 public function showArchiveAction(User $user) 39 public function showArchiveAction(Request $request, User $user)
37 { 40 {
38 return $this->showEntries('archive', $user); 41 return $this->showEntries('archive', $user, $request->query->get('page', 1));
39 } 42 }
40 43
41 /** 44 /**
@@ -46,9 +49,9 @@ class RssController extends Controller
46 * 49 *
47 * @return \Symfony\Component\HttpFoundation\Response 50 * @return \Symfony\Component\HttpFoundation\Response
48 */ 51 */
49 public function showStarredAction(User $user) 52 public function showStarredAction(Request $request, User $user)
50 { 53 {
51 return $this->showEntries('starred', $user); 54 return $this->showEntries('starred', $user, $request->query->get('page', 1));
52 } 55 }
53 56
54 /** 57 /**
@@ -57,10 +60,11 @@ class RssController extends Controller
57 * 60 *
58 * @param string $type Entries type: unread, starred or archive 61 * @param string $type Entries type: unread, starred or archive
59 * @param User $user 62 * @param User $user
63 * @param int $page
60 * 64 *
61 * @return \Symfony\Component\HttpFoundation\Response 65 * @return \Symfony\Component\HttpFoundation\Response
62 */ 66 */
63 private function showEntries($type, User $user) 67 private function showEntries($type, User $user, $page = 1)
64 { 68 {
65 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry'); 69 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry');
66 70
@@ -87,8 +91,26 @@ class RssController extends Controller
87 $perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit'); 91 $perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit');
88 $entries->setMaxPerPage($perPage); 92 $entries->setMaxPerPage($perPage);
89 93
94 $url = $this->generateUrl(
95 $type.'_rss',
96 [
97 'username' => $user->getUsername(),
98 'token' => $user->getConfig()->getRssToken(),
99 ],
100 UrlGeneratorInterface::ABSOLUTE_URL
101 );
102
103 try {
104 $entries->setCurrentPage((int) $page);
105 } catch (OutOfRangeCurrentPageException $e) {
106 if ($page > 1) {
107 return $this->redirect($url.'?page='.$entries->getNbPages(), 302);
108 }
109 }
110
90 return $this->render('@WallabagCore/themes/common/Entry/entries.xml.twig', [ 111 return $this->render('@WallabagCore/themes/common/Entry/entries.xml.twig', [
91 'type' => $type, 112 'type' => $type,
113 'url' => $url,
92 'entries' => $entries, 114 'entries' => $entries,
93 ]); 115 ]);
94 } 116 }
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig
index 288bb54f..16ecaa97 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig
@@ -2,7 +2,15 @@
2<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/"> 2<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/">
3 <channel> 3 <channel>
4 <title>wallabag — {{type}} feed</title> 4 <title>wallabag — {{type}} feed</title>
5 <link>{{ url('unread') }}</link> 5 <link>{{ url(type) }}</link>
6 <link rel="self" href="{{ app.request.uri }}"/>
7 {% if entries.hasPreviousPage -%}
8 <link rel="previous" href="{{ url }}?page={{ entries.previousPage }}"/>
9 {% endif -%}
10 {% if entries.hasNextPage -%}
11 <link rel="next" href="{{ url }}?page={{ entries.nextPage }}"/>
12 {% endif -%}
13 <link rel="last" href="{{ url }}?page={{ entries.nbPages }}"/>
6 <pubDate>{{ "now"|date('D, d M Y H:i:s') }}</pubDate> 14 <pubDate>{{ "now"|date('D, d M Y H:i:s') }}</pubDate>
7 <generator>wallabag</generator> 15 <generator>wallabag</generator>
8 <description>wallabag {{type}} elements</description> 16 <description>wallabag {{type}} elements</description>
diff --git a/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php b/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php
index fb6fe06a..5a59654d 100644
--- a/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/RssControllerTest.php
@@ -6,7 +6,7 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6 6
7class RssControllerTest extends WallabagCoreTestCase 7class RssControllerTest extends WallabagCoreTestCase
8{ 8{
9 public function validateDom($xml, $nb = null) 9 public function validateDom($xml, $type, $nb = null)
10 { 10 {
11 $doc = new \DOMDocument(); 11 $doc = new \DOMDocument();
12 $doc->loadXML($xml); 12 $doc->loadXML($xml);
@@ -22,6 +22,23 @@ class RssControllerTest extends WallabagCoreTestCase
22 $this->assertEquals(1, $xpath->query('/rss')->length); 22 $this->assertEquals(1, $xpath->query('/rss')->length);
23 $this->assertEquals(1, $xpath->query('/rss/channel')->length); 23 $this->assertEquals(1, $xpath->query('/rss/channel')->length);
24 24
25 $this->assertEquals(1, $xpath->query('/rss/channel/title')->length);
26 $this->assertEquals('wallabag — '.$type.' feed', $xpath->query('/rss/channel/title')->item(0)->nodeValue);
27
28 $this->assertEquals(1, $xpath->query('/rss/channel/pubDate')->length);
29
30 $this->assertEquals(1, $xpath->query('/rss/channel/generator')->length);
31 $this->assertEquals('wallabag', $xpath->query('/rss/channel/generator')->item(0)->nodeValue);
32
33 $this->assertEquals(1, $xpath->query('/rss/channel/description')->length);
34 $this->assertEquals('wallabag '.$type.' elements', $xpath->query('/rss/channel/description')->item(0)->nodeValue);
35
36 $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="self"]')->length);
37 $this->assertContains($type.'.xml', $xpath->query('/rss/channel/link[@rel="self"]')->item(0)->getAttribute('href'));
38
39 $this->assertEquals(1, $xpath->query('/rss/channel/link[@rel="last"]')->length);
40 $this->assertContains($type.'.xml?page=', $xpath->query('/rss/channel/link[@rel="last"]')->item(0)->getAttribute('href'));
41
25 foreach ($xpath->query('//item') as $item) { 42 foreach ($xpath->query('//item') as $item) {
26 $this->assertEquals(1, $xpath->query('title', $item)->length); 43 $this->assertEquals(1, $xpath->query('title', $item)->length);
27 $this->assertEquals(1, $xpath->query('source', $item)->length); 44 $this->assertEquals(1, $xpath->query('source', $item)->length);
@@ -77,7 +94,7 @@ class RssControllerTest extends WallabagCoreTestCase
77 94
78 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 95 $this->assertEquals(200, $client->getResponse()->getStatusCode());
79 96
80 $this->validateDom($client->getResponse()->getContent(), 2); 97 $this->validateDom($client->getResponse()->getContent(), 'unread', 2);
81 } 98 }
82 99
83 public function testStarred() 100 public function testStarred()
@@ -99,7 +116,7 @@ class RssControllerTest extends WallabagCoreTestCase
99 116
100 $this->assertEquals(200, $client->getResponse()->getStatusCode(), 1); 117 $this->assertEquals(200, $client->getResponse()->getStatusCode(), 1);
101 118
102 $this->validateDom($client->getResponse()->getContent()); 119 $this->validateDom($client->getResponse()->getContent(), 'starred');
103 } 120 }
104 121
105 public function testArchives() 122 public function testArchives()
@@ -121,6 +138,34 @@ class RssControllerTest extends WallabagCoreTestCase
121 138
122 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 139 $this->assertEquals(200, $client->getResponse()->getStatusCode());
123 140
124 $this->validateDom($client->getResponse()->getContent()); 141 $this->validateDom($client->getResponse()->getContent(), 'archive');
142 }
143
144 public function testPagination()
145 {
146 $client = $this->getClient();
147 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
148 $user = $em
149 ->getRepository('WallabagUserBundle:User')
150 ->findOneByUsername('admin');
151
152 $config = $user->getConfig();
153 $config->setRssToken('SUPERTOKEN');
154 $config->setRssLimit(1);
155 $em->persist($config);
156 $em->flush();
157
158 $client = $this->getClient();
159
160 $client->request('GET', '/admin/SUPERTOKEN/unread.xml');
161 $this->assertEquals(200, $client->getResponse()->getStatusCode());
162 $this->validateDom($client->getResponse()->getContent(), 'unread');
163
164 $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=2');
165 $this->assertEquals(200, $client->getResponse()->getStatusCode());
166 $this->validateDom($client->getResponse()->getContent(), 'unread');
167
168 $client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=3000');
169 $this->assertEquals(302, $client->getResponse()->getStatusCode());
125 } 170 }
126} 171}