From b679b8c0315f96b1aeb3286efd5a36072aeb18cc Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Fri, 27 Sep 2013 20:52:20 +0200 Subject: always open links in new tab --- db/item.php | 4 ++++ fetcher/feedfetcher.php | 6 ++---- tests/unit/articleenhancer/XPathArticleEnhancerTest.php | 4 ++-- tests/unit/db/ItemTest.php | 14 +++++++++++--- tests/unit/fetcher/FeedFetcherTest.php | 2 +- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/db/item.php b/db/item.php index 5c0472eaf..70d3cbb07 100644 --- a/db/item.php +++ b/db/item.php @@ -176,5 +176,9 @@ class Item extends Entity implements IAPI { } + public function setBody($body) { + parent::setBody(str_replace('setBody( - str_replace( - 'purifier->purify( - $simplePieItem->get_content() - ) + $this->purifier->purify( + $simplePieItem->get_content() ) ); 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('linklink2')); $result = $this->testEnhancer->enhance($item); - $this->assertEquals('linklink2', $result->getBody()); + $this->assertEquals('linklink2', $result->getBody()); } public function testTransformRelativeUrlSpecials() { @@ -282,7 +282,7 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility { ->will($this->returnValue('mail')); $result = $this->testEnhancer->enhance($item); - $this->assertEquals('mail', $result->getBody()); + $this->assertEquals('mail', $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("ha"); + $this->assertEquals("ha", + $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')); -- cgit v1.2.3