summaryrefslogtreecommitdiffstats
path: root/tests/unit/articleenhancer
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/articleenhancer')
-rw-r--r--tests/unit/articleenhancer/GlobalArticleEnhancerTest.php18
-rw-r--r--tests/unit/articleenhancer/XPathArticleEnhancerTest.php18
2 files changed, 27 insertions, 9 deletions
diff --git a/tests/unit/articleenhancer/GlobalArticleEnhancerTest.php b/tests/unit/articleenhancer/GlobalArticleEnhancerTest.php
index 3add03eb5..79647a882 100644
--- a/tests/unit/articleenhancer/GlobalArticleEnhancerTest.php
+++ b/tests/unit/articleenhancer/GlobalArticleEnhancerTest.php
@@ -26,8 +26,12 @@ class GlobalArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
public function testNoReplaceYoutubeAutoplay() {
- $body = '<iframe width="728" height="410" src="//www.youtube.com/embed/autoplay=1/AWE6UpXQoGU" frameborder="0" allowfullscreen=""></iframe>';
- $expected = '<div><iframe width="728" height="410" src="//www.youtube.com/embed/autoplay=1/AWE6UpXQoGU" frameborder="0" allowfullscreen=""></iframe></div>';
+ $body = '<iframe width="728" height="410" ' .
+ 'src="//www.youtube.com/embed/autoplay=1/AWE6UpXQoGU" ' .
+ 'frameborder="0" allowfullscreen=""></iframe>';
+ $expected = '<div><iframe width="728" height="410" ' .
+ 'src="//www.youtube.com/embed/autoplay=1/AWE6UpXQoGU" ' .
+ 'frameborder="0" allowfullscreen=""></iframe></div>';
$item = new Item();
$item->setBody($body);
@@ -37,8 +41,14 @@ class GlobalArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
public function testReplaceYoutubeAutoplay() {
- $body = 'test <iframe width="728" height="410" src="//www.youtube.com/embed/AWE6UpXQoGU?tst=1&autoplay=1&abc=1" frameborder="0" allowfullscreen=""></iframe>';
- $expected = '<div>test <iframe width="728" height="410" src="//www.youtube.com/embed/AWE6UpXQoGU?tst=1&amp;autoplay=0&amp;abc=1" frameborder="0" allowfullscreen=""></iframe></div>';
+ $body = 'test <iframe width="728" height="410" ' .
+ 'src="//www.youtube.com/embed' .
+ '/AWE6UpXQoGU?tst=1&autoplay=1&abc=1" frameborder="0" ' .
+ 'allowfullscreen=""></iframe>';
+ $expected = '<div>test <iframe width="728" height="410" ' .
+ 'src="//www.youtube.com/embed' .
+ '/AWE6UpXQoGU?tst=1&amp;autoplay=0&amp;abc=1" frameborder="0" ' .
+ 'allowfullscreen=""></iframe></div>';
$item = new Item();
$item->setBody($body);
diff --git a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
index 0d4130e9e..00c4e7cb0 100644
--- a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
+++ b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
@@ -30,7 +30,8 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
protected function setUp() {
$this->timeout = 30;
- $this->fileFactory = $this->getMockBuilder('\OCA\News\Utility\SimplePieAPIFactory')
+ $this->fileFactory = $this
+ ->getMockBuilder('\OCA\News\Utility\SimplePieAPIFactory')
->disableOriginalConstructor()
->getMock();
$this->proxyHost = 'test';
@@ -56,7 +57,8 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
$this->testEnhancer = new XPathArticleEnhancer(
$this->fileFactory,
[
- '/explosm.net\/comics/' => '//*[@id=\'maincontent\']/div[2]/div/span',
+ '/explosm.net\/comics/' =>
+ '//*[@id=\'maincontent\']/div[2]/div/span',
'/explosm.net\/shorts/' => '//*[@id=\'maincontent\']/div/div',
'/explosm.net\/all/' => '//body/*',
'/themerepublic.net/' => '//*[@class=\'post hentry\']'
@@ -259,8 +261,12 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
$result = $this->testEnhancer->enhance($item);
$this->assertEquals('<div>' .
- '<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>' .
+ '<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">' .
'</div>', $result->getBody());
}
@@ -288,7 +294,9 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
$result = $this->testEnhancer->enhance($item);
$this->assertEquals(
- '<div><img src="https://username:secret@www.explosm.net/all/relative/url.png?a=1&amp;b=2"></div>',
+ '<div><img src="' .
+ 'https://username:secret@www.explosm.net' .
+ '/all/relative/url.png?a=1&amp;b=2"></div>',
$result->getBody());
}