aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2015-09-23 09:13:34 +0200
committerNicolas Lœuillet <nicolas@loeuillet.org>2015-09-23 09:13:34 +0200
commit57162494557c5eac938a7d6800ac1b112f73efc9 (patch)
tree0e0638166e8b734e17b9eb9a4c86d9008ed7be3d /src/Wallabag/CoreBundle/Tests
parent1db9d411c5b1fe592788866dc206e2fd6dc87a71 (diff)
parentd4ebe5c5dcf581416ab76136908cafbde78f63bf (diff)
downloadwallabag-57162494557c5eac938a7d6800ac1b112f73efc9.tar.gz
wallabag-57162494557c5eac938a7d6800ac1b112f73efc9.tar.zst
wallabag-57162494557c5eac938a7d6800ac1b112f73efc9.zip
Merge pull request #1429 from wallabag/v2-language
V2 – Handle language in entry
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php23
-rw-r--r--src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php24
2 files changed, 45 insertions, 2 deletions
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
382 $crawler = $client->submit($form); 382 $crawler = $client->submit($form);
383 $this->assertCount(1, $crawler->filter('div[class=entry]')); 383 $this->assertCount(1, $crawler->filter('div[class=entry]'));
384 } 384 }
385
386 public function testFilterOnLanguage()
387 {
388 $this->logInAs('admin');
389 $client = $this->getClient();
390
391 $crawler = $client->request('GET', '/unread/list');
392 $form = $crawler->filter('button[id=submit-filter]')->form();
393 $data = array(
394 'entry_filter[language]' => 'de',
395 );
396
397 $crawler = $client->submit($form, $data);
398 $this->assertCount(1, $crawler->filter('div[class=entry]'));
399
400 $form = $crawler->filter('button[id=submit-filter]')->form();
401 $data = array(
402 'entry_filter[language]' => 'en',
403 );
404
405 $crawler = $client->submit($form, $data);
406 $this->assertCount(2, $crawler->filter('div[class=entry]'));
407 }
385} 408}
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
18 18
19 $graby->expects($this->any()) 19 $graby->expects($this->any())
20 ->method('fetchContent') 20 ->method('fetchContent')
21 ->willReturn(array('html' => false, 'title' => '', 'url' => '', 'content_type' => '')); 21 ->willReturn(array(
22 'html' => false,
23 'title' => '',
24 'url' => '',
25 'content_type' => '',
26 'language' => '',
27 ));
22 28
23 $proxy = new ContentProxy($graby); 29 $proxy = new ContentProxy($graby);
24 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 30 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
@@ -28,6 +34,7 @@ class ContentProxyTest extends KernelTestCase
28 $this->assertEquals('<p>Unable to retrieve readable content.</p>', $entry->getContent()); 34 $this->assertEquals('<p>Unable to retrieve readable content.</p>', $entry->getContent());
29 $this->assertEmpty($entry->getPreviewPicture()); 35 $this->assertEmpty($entry->getPreviewPicture());
30 $this->assertEmpty($entry->getMimetype()); 36 $this->assertEmpty($entry->getMimetype());
37 $this->assertEmpty($entry->getLanguage());
31 } 38 }
32 39
33 public function testWithEmptyContentButOG() 40 public function testWithEmptyContentButOG()
@@ -39,7 +46,17 @@ class ContentProxyTest extends KernelTestCase
39 46
40 $graby->expects($this->any()) 47 $graby->expects($this->any())
41 ->method('fetchContent') 48 ->method('fetchContent')
42 ->willReturn(array('html' => false, 'title' => '', 'url' => '', 'content_type' => '', 'open_graph' => array('og_title' => 'my title', 'og_description' => 'desc'))); 49 ->willReturn(array(
50 'html' => false,
51 'title' => '',
52 'url' => '',
53 'content_type' => '',
54 'language' => '',
55 'open_graph' => array(
56 'og_title' => 'my title',
57 'og_description' => 'desc',
58 ),
59 ));
43 60
44 $proxy = new ContentProxy($graby); 61 $proxy = new ContentProxy($graby);
45 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 62 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
@@ -48,6 +65,7 @@ class ContentProxyTest extends KernelTestCase
48 $this->assertEquals('my title', $entry->getTitle()); 65 $this->assertEquals('my title', $entry->getTitle());
49 $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent()); 66 $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent());
50 $this->assertEmpty($entry->getPreviewPicture()); 67 $this->assertEmpty($entry->getPreviewPicture());
68 $this->assertEmpty($entry->getLanguage());
51 $this->assertEmpty($entry->getMimetype()); 69 $this->assertEmpty($entry->getMimetype());
52 } 70 }
53 71
@@ -65,6 +83,7 @@ class ContentProxyTest extends KernelTestCase
65 'title' => 'this is my title', 83 'title' => 'this is my title',
66 'url' => 'http://1.1.1.1', 84 'url' => 'http://1.1.1.1',
67 'content_type' => 'text/html', 85 'content_type' => 'text/html',
86 'language' => 'fr',
68 'open_graph' => array( 87 'open_graph' => array(
69 'og_title' => 'my OG title', 88 'og_title' => 'my OG title',
70 'og_description' => 'OG desc', 89 'og_description' => 'OG desc',
@@ -80,5 +99,6 @@ class ContentProxyTest extends KernelTestCase
80 $this->assertEquals('this is my content', $entry->getContent()); 99 $this->assertEquals('this is my content', $entry->getContent());
81 $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); 100 $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture());
82 $this->assertEquals('text/html', $entry->getMimetype()); 101 $this->assertEquals('text/html', $entry->getMimetype());
102 $this->assertEquals('fr', $entry->getLanguage());
83 } 103 }
84} 104}