From 98f0929f168a336079456f65b6ca41e84b22efff Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 20 Sep 2015 22:37:27 +0200 Subject: Handle entry in language Fix #1333 --- .../CoreBundle/Tests/Helper/ContentProxyTest.php | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/Tests') diff --git a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php index 71a004ff..30065d6b 100644 --- a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php +++ b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php @@ -18,7 +18,13 @@ class ContentProxyTest extends KernelTestCase $graby->expects($this->any()) ->method('fetchContent') - ->willReturn(array('html' => false, 'title' => '', 'url' => '', 'content_type' => '')); + ->willReturn(array( + 'html' => false, + 'title' => '', + 'url' => '', + 'content_type' => '', + 'language' => '', + )); $proxy = new ContentProxy($graby); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); @@ -28,6 +34,7 @@ class ContentProxyTest extends KernelTestCase $this->assertEquals('

Unable to retrieve readable content.

', $entry->getContent()); $this->assertEmpty($entry->getPreviewPicture()); $this->assertEmpty($entry->getMimetype()); + $this->assertEmpty($entry->getLanguage()); } public function testWithEmptyContentButOG() @@ -39,7 +46,17 @@ class ContentProxyTest extends KernelTestCase $graby->expects($this->any()) ->method('fetchContent') - ->willReturn(array('html' => false, 'title' => '', 'url' => '', 'content_type' => '', 'open_graph' => array('og_title' => 'my title', 'og_description' => 'desc'))); + ->willReturn(array( + 'html' => false, + 'title' => '', + 'url' => '', + 'content_type' => '', + 'language' => '', + 'open_graph' => array( + 'og_title' => 'my title', + 'og_description' => 'desc', + ), + )); $proxy = new ContentProxy($graby); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); @@ -48,6 +65,7 @@ class ContentProxyTest extends KernelTestCase $this->assertEquals('my title', $entry->getTitle()); $this->assertEquals('

Unable to retrieve readable content.

But we found a short description:

desc', $entry->getContent()); $this->assertEmpty($entry->getPreviewPicture()); + $this->assertEmpty($entry->getLanguage()); $this->assertEmpty($entry->getMimetype()); } @@ -65,6 +83,7 @@ class ContentProxyTest extends KernelTestCase 'title' => 'this is my title', 'url' => 'http://1.1.1.1', 'content_type' => 'text/html', + 'language' => 'fr', 'open_graph' => array( 'og_title' => 'my OG title', 'og_description' => 'OG desc', @@ -80,5 +99,6 @@ class ContentProxyTest extends KernelTestCase $this->assertEquals('this is my content', $entry->getContent()); $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); $this->assertEquals('text/html', $entry->getMimetype()); + $this->assertEquals('fr', $entry->getLanguage()); } } -- cgit v1.2.3 From d4ebe5c5dcf581416ab76136908cafbde78f63bf Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 23 Sep 2015 07:55:55 +0200 Subject: Entries filter on language + updated deps --- .../Tests/Controller/EntryControllerTest.php | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/Wallabag/CoreBundle/Tests') diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 77b57884..cbd84a97 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php @@ -382,4 +382,27 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->submit($form); $this->assertCount(1, $crawler->filter('div[class=entry]')); } + + public function testFilterOnLanguage() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/unread/list'); + $form = $crawler->filter('button[id=submit-filter]')->form(); + $data = array( + 'entry_filter[language]' => 'de', + ); + + $crawler = $client->submit($form, $data); + $this->assertCount(1, $crawler->filter('div[class=entry]')); + + $form = $crawler->filter('button[id=submit-filter]')->form(); + $data = array( + 'entry_filter[language]' => 'en', + ); + + $crawler = $client->submit($form, $data); + $this->assertCount(2, $crawler->filter('div[class=entry]')); + } } -- cgit v1.2.3