aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2015-09-28 19:35:33 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2015-09-28 19:35:33 +0200
commitda3d4998c0972557952c83b610f8f45fdcd31b72 (patch)
treeca4f91e1b54c0db19e12663405cc30b9275817d9 /src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php
parent34c2cc7a1a2b8f1ac606957096274b3998005ec0 (diff)
downloadwallabag-da3d4998c0972557952c83b610f8f45fdcd31b72.tar.gz
wallabag-da3d4998c0972557952c83b610f8f45fdcd31b72.tar.zst
wallabag-da3d4998c0972557952c83b610f8f45fdcd31b72.zip
Move readingTime & domainName in ContentProxy
So, everything is centralized in one place when we save a new entry.
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php
index 30065d6b..0d338389 100644
--- a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php
@@ -35,6 +35,8 @@ class ContentProxyTest extends KernelTestCase
35 $this->assertEmpty($entry->getPreviewPicture()); 35 $this->assertEmpty($entry->getPreviewPicture());
36 $this->assertEmpty($entry->getMimetype()); 36 $this->assertEmpty($entry->getMimetype());
37 $this->assertEmpty($entry->getLanguage()); 37 $this->assertEmpty($entry->getLanguage());
38 $this->assertEquals(0.0, $entry->getReadingTime());
39 $this->assertEquals('0.0.0.0', $entry->getDomainName());
38 } 40 }
39 41
40 public function testWithEmptyContentButOG() 42 public function testWithEmptyContentButOG()
@@ -59,14 +61,16 @@ class ContentProxyTest extends KernelTestCase
59 )); 61 ));
60 62
61 $proxy = new ContentProxy($graby); 63 $proxy = new ContentProxy($graby);
62 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 64 $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io');
63 65
64 $this->assertEquals('http://0.0.0.0', $entry->getUrl()); 66 $this->assertEquals('http://domain.io', $entry->getUrl());
65 $this->assertEquals('my title', $entry->getTitle()); 67 $this->assertEquals('my title', $entry->getTitle());
66 $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent()); 68 $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent());
67 $this->assertEmpty($entry->getPreviewPicture()); 69 $this->assertEmpty($entry->getPreviewPicture());
68 $this->assertEmpty($entry->getLanguage()); 70 $this->assertEmpty($entry->getLanguage());
69 $this->assertEmpty($entry->getMimetype()); 71 $this->assertEmpty($entry->getMimetype());
72 $this->assertEquals(0.0, $entry->getReadingTime());
73 $this->assertEquals('domain.io', $entry->getDomainName());
70 } 74 }
71 75
72 public function testWithContent() 76 public function testWithContent()
@@ -79,7 +83,7 @@ class ContentProxyTest extends KernelTestCase
79 $graby->expects($this->any()) 83 $graby->expects($this->any())
80 ->method('fetchContent') 84 ->method('fetchContent')
81 ->willReturn(array( 85 ->willReturn(array(
82 'html' => 'this is my content', 86 'html' => str_repeat('this is my content', 325),
83 'title' => 'this is my title', 87 'title' => 'this is my title',
84 'url' => 'http://1.1.1.1', 88 'url' => 'http://1.1.1.1',
85 'content_type' => 'text/html', 89 'content_type' => 'text/html',
@@ -96,9 +100,11 @@ class ContentProxyTest extends KernelTestCase
96 100
97 $this->assertEquals('http://1.1.1.1', $entry->getUrl()); 101 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
98 $this->assertEquals('this is my title', $entry->getTitle()); 102 $this->assertEquals('this is my title', $entry->getTitle());
99 $this->assertEquals('this is my content', $entry->getContent()); 103 $this->assertContains('this is my content', $entry->getContent());
100 $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); 104 $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture());
101 $this->assertEquals('text/html', $entry->getMimetype()); 105 $this->assertEquals('text/html', $entry->getMimetype());
102 $this->assertEquals('fr', $entry->getLanguage()); 106 $this->assertEquals('fr', $entry->getLanguage());
107 $this->assertEquals(4.0, $entry->getReadingTime());
108 $this->assertEquals('1.1.1.1', $entry->getDomainName());
103 } 109 }
104} 110}