]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
ContentProxy: swap entry url to origin_url and set new url according to graby content
[github/wallabag/wallabag.git] / tests / Wallabag / CoreBundle / Helper / ContentProxyTest.php
index 398592e1fa519577d1ff90fd4d4686c6c7d21b7d..c1a56b89b0600f03482bd2b9d28649958ab1e1d5 100644 (file)
@@ -532,6 +532,32 @@ class ContentProxyTest extends TestCase
         $this->assertSame('1.1.1.1', $entry->getDomainName());
     }
 
+    public function testWithChangedUrl()
+    {
+        $tagger = $this->getTaggerMock();
+        $tagger->expects($this->once())
+            ->method('tag');
+
+        $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true);
+        $entry = new Entry(new User());
+        $proxy->updateEntry(
+            $entry,
+            'http://0.0.0.0',
+            [
+                'html' => false,
+                'title' => '',
+                'url' => 'http://1.1.1.1',
+                'content_type' => '',
+                'language' => '',
+            ],
+            true
+        );
+
+        $this->assertSame('http://1.1.1.1', $entry->getUrl());
+        $this->assertSame('1.1.1.1', $entry->getDomainName());
+        $this->assertSame('http://0.0.0.0', $entry->getOriginUrl());
+    }
+
     private function getTaggerMock()
     {
         return $this->getMockBuilder(RuleBasedTagger::class)