diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2013-09-27 20:52:20 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2013-09-27 20:52:20 +0200 |
commit | b679b8c0315f96b1aeb3286efd5a36072aeb18cc (patch) | |
tree | 99a09362381941540ef053309a86122be8638be3 /tests | |
parent | 15c663658ecf19bdc6257e57825e943735aece0f (diff) |
always open links in new tab
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/articleenhancer/XPathArticleEnhancerTest.php | 4 | ||||
-rw-r--r-- | tests/unit/db/ItemTest.php | 14 | ||||
-rw-r--r-- | tests/unit/fetcher/FeedFetcherTest.php | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php index a0f8db388..26381057c 100644 --- a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php +++ b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php @@ -229,7 +229,7 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility { ->will($this->returnValue('<a href="https://www.explosm.net/a/relative/url.html?a=1#b">link</a><a href="https://www.explosm.net/all/b/relative/url.html">link2</a><img src="https://www.explosm.net/another/relative/link.jpg">')); $result = $this->testEnhancer->enhance($item); - $this->assertEquals('<a href="https://www.explosm.net/a/relative/url.html?a=1#b">link</a><a href="https://www.explosm.net/all/b/relative/url.html">link2</a><img src="https://www.explosm.net/another/relative/link.jpg">', $result->getBody()); + $this->assertEquals('<a target="_blank" href="https://www.explosm.net/a/relative/url.html?a=1#b">link</a><a target="_blank" href="https://www.explosm.net/all/b/relative/url.html">link2</a><img src="https://www.explosm.net/another/relative/link.jpg">', $result->getBody()); } public function testTransformRelativeUrlSpecials() { @@ -282,7 +282,7 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility { ->will($this->returnValue('<img src="http://www.url.com/absolute/url.png"><a href="mailto:test@testsite.com">mail</a>')); $result = $this->testEnhancer->enhance($item); - $this->assertEquals('<img src="http://www.url.com/absolute/url.png"><a href="mailto:test@testsite.com">mail</a>', $result->getBody()); + $this->assertEquals('<img src="http://www.url.com/absolute/url.png"><a target="_blank" href="mailto:test@testsite.com">mail</a>', $result->getBody()); } }
\ No newline at end of file diff --git a/tests/unit/db/ItemTest.php b/tests/unit/db/ItemTest.php index b4360f273..dab4fdd90 100644 --- a/tests/unit/db/ItemTest.php +++ b/tests/unit/db/ItemTest.php @@ -200,9 +200,17 @@ class ItemTest extends \PHPUnit_Framework_TestCase { public function testSetGuidUpdatesHash() { - $feed = new Item(); - $feed->setGuid('http://test'); - $this->assertEquals(md5('http://test'), $feed->getGuidHash()); + $item = new Item(); + $item->setGuid('http://test'); + $this->assertEquals(md5('http://test'), $item->getGuidHash()); + } + + + public function testMakeLinksInBodyOpenNewTab() { + $item = new Item(); + $item->setBody("<a href=\"test\">ha</a>"); + $this->assertEquals("<a target=\"_blank\" href=\"test\">ha</a>", + $item->getBody()); } diff --git a/tests/unit/fetcher/FeedFetcherTest.php b/tests/unit/fetcher/FeedFetcherTest.php index 466bcc446..83ba3b809 100644 --- a/tests/unit/fetcher/FeedFetcherTest.php +++ b/tests/unit/fetcher/FeedFetcherTest.php @@ -199,7 +199,7 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility { $item->setTitle('my<\' title'); $item->setGuid($this->guid); $item->setGuidHash(md5($this->guid)); - $item->setBody($this->body2); + $item->setBody($this->body); $item->setLastModified($this->time); if($author) { $mock = $this->getMock('author', array('get_name')); |