forked from wallabag/wallabag
Changed RSS to Atom feed and improve paging
This commit is contained in:
committed by
Jeremy Benoist
parent
522e37ad27
commit
531c8d0a5c
@ -33,7 +33,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
$this->assertCount(1, $crawler->filter('button[id=config_save]'));
|
||||
$this->assertCount(1, $crawler->filter('button[id=change_passwd_save]'));
|
||||
$this->assertCount(1, $crawler->filter('button[id=update_user_save]'));
|
||||
$this->assertCount(1, $crawler->filter('button[id=rss_config_save]'));
|
||||
$this->assertCount(1, $crawler->filter('button[id=feed_config_save]'));
|
||||
}
|
||||
|
||||
public function testUpdate()
|
||||
@ -297,7 +297,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
$this->assertContains('flashes.config.notice.user_updated', $alert[0]);
|
||||
}
|
||||
|
||||
public function testRssUpdateResetToken()
|
||||
public function testFeedUpdateResetToken()
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
@ -313,7 +313,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
}
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setRssToken(null);
|
||||
$config->setFeedToken(null);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
@ -322,7 +322,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertContains('config.form_rss.no_token', $body[0]);
|
||||
$this->assertContains('config.form_feed.no_token', $body[0]);
|
||||
|
||||
$client->request('GET', '/generate-token');
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
@ -330,7 +330,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertNotContains('config.form_rss.no_token', $body[0]);
|
||||
$this->assertNotContains('config.form_feed.no_token', $body[0]);
|
||||
}
|
||||
|
||||
public function testGenerateTokenAjax()
|
||||
@ -351,7 +351,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
$this->assertArrayHasKey('token', $content);
|
||||
}
|
||||
|
||||
public function testRssUpdate()
|
||||
public function testFeedUpdate()
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
@ -360,10 +360,10 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$form = $crawler->filter('button[id=rss_config_save]')->form();
|
||||
$form = $crawler->filter('button[id=feed_config_save]')->form();
|
||||
|
||||
$data = [
|
||||
'rss_config[rss_limit]' => 12,
|
||||
'feed_config[feed_limit]' => 12,
|
||||
];
|
||||
|
||||
$client->submit($form, $data);
|
||||
@ -372,31 +372,31 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
$this->assertContains('flashes.config.notice.rss_updated', $crawler->filter('body')->extract(['_text'])[0]);
|
||||
$this->assertContains('flashes.config.notice.feed_updated', $crawler->filter('body')->extract(['_text'])[0]);
|
||||
}
|
||||
|
||||
public function dataForRssFailed()
|
||||
public function dataForFeedFailed()
|
||||
{
|
||||
return [
|
||||
[
|
||||
[
|
||||
'rss_config[rss_limit]' => 0,
|
||||
'feed_config[feed_limit]' => 0,
|
||||
],
|
||||
'This value should be 1 or more.',
|
||||
],
|
||||
[
|
||||
[
|
||||
'rss_config[rss_limit]' => 1000000000000,
|
||||
'feed_config[feed_limit]' => 1000000000000,
|
||||
],
|
||||
'validator.rss_limit_too_high',
|
||||
'validator.feed_limit_too_high',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataForRssFailed
|
||||
* @dataProvider dataForFeedFailed
|
||||
*/
|
||||
public function testRssFailed($data, $expectedMessage)
|
||||
public function testFeedFailed($data, $expectedMessage)
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
@ -405,7 +405,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$form = $crawler->filter('button[id=rss_config_save]')->form();
|
||||
$form = $crawler->filter('button[id=feed_config_save]')->form();
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
|
||||
228
tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php
Normal file
228
tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php
Normal file
@ -0,0 +1,228 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
||||
class FeedControllerTest extends WallabagCoreTestCase
|
||||
{
|
||||
public function validateDom($xml, $type, $nb = null, $tagValue = null)
|
||||
{
|
||||
$doc = new \DOMDocument();
|
||||
$doc->loadXML($xml);
|
||||
|
||||
$xpath = new \DOMXpath($doc);
|
||||
$xpath->registerNamespace('a', 'http://www.w3.org/2005/Atom');
|
||||
|
||||
if (null === $nb) {
|
||||
$this->assertGreaterThan(0, $xpath->query('//a:entry')->length);
|
||||
} else {
|
||||
$this->assertEquals($nb, $xpath->query('//a:entry')->length);
|
||||
}
|
||||
|
||||
$this->assertEquals(1, $xpath->query('/a:feed')->length);
|
||||
|
||||
$this->assertEquals(1, $xpath->query('/a:feed/a:title')->length);
|
||||
$this->assertContains('favicon.ico', $xpath->query('/a:feed/a:icon')->item(0)->nodeValue);
|
||||
$this->assertContains('logo-square.png', $xpath->query('/a:feed/a:logo')->item(0)->nodeValue);
|
||||
|
||||
$this->assertEquals(1, $xpath->query('/a:feed/a:updated')->length);
|
||||
|
||||
$this->assertEquals(1, $xpath->query('/a:feed/a:generator')->length);
|
||||
$this->assertEquals('wallabag', $xpath->query('/a:feed/a:generator')->item(0)->nodeValue);
|
||||
$this->assertEquals('admin', $xpath->query('/a:feed/a:author/a:name')->item(0)->nodeValue);
|
||||
|
||||
$this->assertEquals(1, $xpath->query('/a:feed/a:subtitle')->length);
|
||||
if (null !== $tagValue && 0 === strpos($type, 'tag')) {
|
||||
$this->assertEquals('wallabag — '.$type.' '.$tagValue.' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue);
|
||||
$this->assertEquals('Atom feed for entries tagged with ' . $tagValue, $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue);
|
||||
} else {
|
||||
$this->assertEquals('wallabag — '.$type.' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue);
|
||||
$this->assertEquals('Atom feed for ' . $type . ' entries', $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue);
|
||||
}
|
||||
|
||||
$this->assertEquals(1, $xpath->query('/a:feed/a:link[@rel="self"]')->length);
|
||||
$this->assertContains($type, $xpath->query('/a:feed/a:link[@rel="self"]')->item(0)->getAttribute('href'));
|
||||
|
||||
$this->assertEquals(1, $xpath->query('/a:feed/a:link[@rel="last"]')->length);
|
||||
|
||||
foreach ($xpath->query('//a:entry') as $item) {
|
||||
$this->assertEquals(1, $xpath->query('a:title', $item)->length);
|
||||
$this->assertEquals(1, $xpath->query('a:link[@rel="via"]', $item)->length);
|
||||
$this->assertEquals(1, $xpath->query('a:link[@rel="alternate"]', $item)->length);
|
||||
$this->assertEquals(1, $xpath->query('a:id', $item)->length);
|
||||
$this->assertEquals(1, $xpath->query('a:published', $item)->length);
|
||||
$this->assertEquals(1, $xpath->query('a:content', $item)->length);
|
||||
}
|
||||
}
|
||||
|
||||
public function dataForBadUrl()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'/feed/admin/YZIOAUZIAO/unread',
|
||||
],
|
||||
[
|
||||
'/feed/wallace/YZIOAUZIAO/starred',
|
||||
],
|
||||
[
|
||||
'/feed/wallace/YZIOAUZIAO/archives',
|
||||
],
|
||||
[
|
||||
'/feed/wallace/YZIOAUZIAO/all',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataForBadUrl
|
||||
*/
|
||||
public function testBadUrl($url)
|
||||
{
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->request('GET', $url);
|
||||
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public function testUnread()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setFeedToken('SUPERTOKEN');
|
||||
$config->setFeedLimit(2);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client->request('GET', '/feed/admin/SUPERTOKEN/unread');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$this->validateDom($client->getResponse()->getContent(), 'unread', 2);
|
||||
}
|
||||
|
||||
public function testStarred()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setFeedToken('SUPERTOKEN');
|
||||
$config->setFeedLimit(1);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client = $this->getClient();
|
||||
$client->request('GET', '/feed/admin/SUPERTOKEN/starred');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode(), 1);
|
||||
|
||||
$this->validateDom($client->getResponse()->getContent(), 'starred');
|
||||
}
|
||||
|
||||
public function testArchives()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setFeedToken('SUPERTOKEN');
|
||||
$config->setFeedLimit(null);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client = $this->getClient();
|
||||
$client->request('GET', '/feed/admin/SUPERTOKEN/archive');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$this->validateDom($client->getResponse()->getContent(), 'archive');
|
||||
}
|
||||
|
||||
public function testAll()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setFeedToken('SUPERTOKEN');
|
||||
$config->setFeedLimit(null);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client = $this->getClient();
|
||||
$client->request('GET', '/feed/admin/SUPERTOKEN/all');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$this->validateDom($client->getResponse()->getContent(), 'all');
|
||||
}
|
||||
|
||||
public function testPagination()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setFeedToken('SUPERTOKEN');
|
||||
$config->setFeedLimit(1);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->request('GET', '/feed/admin/SUPERTOKEN/unread');
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
$this->validateDom($client->getResponse()->getContent(), 'unread');
|
||||
|
||||
$client->request('GET', '/feed/admin/SUPERTOKEN/unread/2');
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
$this->validateDom($client->getResponse()->getContent(), 'unread');
|
||||
|
||||
$client->request('GET', '/feed/admin/SUPERTOKEN/unread/3000');
|
||||
$this->assertEquals(302, $client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public function testTags()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setFeedToken('SUPERTOKEN');
|
||||
$config->setFeedLimit(null);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client = $this->getClient();
|
||||
$client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$this->validateDom($client->getResponse()->getContent(), 'tag', 2, 'foo-bar');
|
||||
|
||||
$client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml?page=3000');
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
}
|
||||
}
|
||||
@ -1,221 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
||||
class RssControllerTest extends WallabagCoreTestCase
|
||||
{
|
||||
public function validateDom($xml, $type, $urlPagination, $nb = null)
|
||||
{
|
||||
$doc = new \DOMDocument();
|
||||
$doc->loadXML($xml);
|
||||
|
||||
$xpath = new \DOMXPath($doc);
|
||||
|
||||
if (null === $nb) {
|
||||
$this->assertGreaterThan(0, $xpath->query('//item')->length);
|
||||
} else {
|
||||
$this->assertSame($nb, $xpath->query('//item')->length);
|
||||
}
|
||||
|
||||
$this->assertSame(1, $xpath->query('/rss')->length);
|
||||
$this->assertSame(1, $xpath->query('/rss/channel')->length);
|
||||
|
||||
$this->assertSame(1, $xpath->query('/rss/channel/title')->length);
|
||||
$this->assertSame('wallabag - ' . $type . ' feed', $xpath->query('/rss/channel/title')->item(0)->nodeValue);
|
||||
|
||||
$this->assertSame(1, $xpath->query('/rss/channel/pubDate')->length);
|
||||
|
||||
$this->assertSame(1, $xpath->query('/rss/channel/generator')->length);
|
||||
$this->assertSame('wallabag', $xpath->query('/rss/channel/generator')->item(0)->nodeValue);
|
||||
|
||||
$this->assertSame(1, $xpath->query('/rss/channel/description')->length);
|
||||
$this->assertSame('wallabag ' . $type . ' elements', $xpath->query('/rss/channel/description')->item(0)->nodeValue);
|
||||
|
||||
$this->assertSame(1, $xpath->query('/rss/channel/link[@rel="self"]')->length);
|
||||
$this->assertContains($urlPagination . '.xml', $xpath->query('/rss/channel/link[@rel="self"]')->item(0)->getAttribute('href'));
|
||||
|
||||
$this->assertSame(1, $xpath->query('/rss/channel/link[@rel="last"]')->length);
|
||||
$this->assertContains($urlPagination . '.xml?page=', $xpath->query('/rss/channel/link[@rel="last"]')->item(0)->getAttribute('href'));
|
||||
|
||||
foreach ($xpath->query('//item') as $item) {
|
||||
$this->assertSame(1, $xpath->query('title', $item)->length);
|
||||
$this->assertSame(1, $xpath->query('source', $item)->length);
|
||||
$this->assertSame(1, $xpath->query('link', $item)->length);
|
||||
$this->assertSame(1, $xpath->query('guid', $item)->length);
|
||||
$this->assertSame(1, $xpath->query('pubDate', $item)->length);
|
||||
$this->assertSame(1, $xpath->query('description', $item)->length);
|
||||
}
|
||||
}
|
||||
|
||||
public function dataForBadUrl()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'/admin/YZIOAUZIAO/unread.xml',
|
||||
],
|
||||
[
|
||||
'/wallace/YZIOAUZIAO/starred.xml',
|
||||
],
|
||||
[
|
||||
'/wallace/YZIOAUZIAO/archives.xml',
|
||||
],
|
||||
[
|
||||
'/wallace/YZIOAUZIAO/all.xml',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataForBadUrl
|
||||
*/
|
||||
public function testBadUrl($url)
|
||||
{
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->request('GET', $url);
|
||||
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public function testUnread()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setRssToken('SUPERTOKEN');
|
||||
$config->setRssLimit(2);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client->request('GET', '/admin/SUPERTOKEN/unread.xml');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$this->validateDom($client->getResponse()->getContent(), 'unread', 'unread', 2);
|
||||
}
|
||||
|
||||
public function testStarred()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setRssToken('SUPERTOKEN');
|
||||
$config->setRssLimit(1);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client = $this->getClient();
|
||||
$client->request('GET', '/admin/SUPERTOKEN/starred.xml');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode(), 1);
|
||||
|
||||
$this->validateDom($client->getResponse()->getContent(), 'starred', 'starred');
|
||||
}
|
||||
|
||||
public function testArchives()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setRssToken('SUPERTOKEN');
|
||||
$config->setRssLimit(null);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client = $this->getClient();
|
||||
$client->request('GET', '/admin/SUPERTOKEN/archive.xml');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$this->validateDom($client->getResponse()->getContent(), 'archive', 'archive');
|
||||
}
|
||||
|
||||
public function testAll()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setRssToken('SUPERTOKEN');
|
||||
$config->setRssLimit(null);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client = $this->getClient();
|
||||
$client->request('GET', '/admin/SUPERTOKEN/all.xml');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$this->validateDom($client->getResponse()->getContent(), 'all', 'all');
|
||||
}
|
||||
|
||||
public function testPagination()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setRssToken('SUPERTOKEN');
|
||||
$config->setRssLimit(1);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->request('GET', '/admin/SUPERTOKEN/unread.xml');
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
$this->validateDom($client->getResponse()->getContent(), 'unread', 'unread');
|
||||
|
||||
$client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=2');
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
$this->validateDom($client->getResponse()->getContent(), 'unread', 'unread');
|
||||
|
||||
$client->request('GET', '/admin/SUPERTOKEN/unread.xml?page=3000');
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public function testTags()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$user = $em
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setRssToken('SUPERTOKEN');
|
||||
$config->setRssLimit(null);
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$client = $this->getClient();
|
||||
$client->request('GET', '/admin/SUPERTOKEN/tags/foo.xml');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$this->validateDom($client->getResponse()->getContent(), 'tag (foo)', 'tags/foo');
|
||||
|
||||
$client->request('GET', '/admin/SUPERTOKEN/tags/foo.xml?page=3000');
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
}
|
||||
}
|
||||
@ -23,7 +23,7 @@ class SecurityControllerTest extends WallabagCoreTestCase
|
||||
$client->followRedirects();
|
||||
|
||||
$crawler = $client->request('GET', '/config');
|
||||
$this->assertContains('config.form_rss.description', $crawler->filter('body')->extract(['_text'])[0]);
|
||||
$this->assertContains('config.form_feed.description', $crawler->filter('body')->extract(['_text'])[0]);
|
||||
}
|
||||
|
||||
public function testLoginWith2FactorEmail()
|
||||
|
||||
Reference in New Issue
Block a user