]> 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 3f3c60d0fd943436f88759853b9ee5c950b554e2..84b38f026125871c8dd51552d782d11a7d601d2b 100644 (file)
@@ -775,6 +775,32 @@ class ContentProxyTest extends TestCase
         return $string;
     }
 
+    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)