summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-04-09 12:57:21 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-04-09 12:57:33 +0200
commitfcef0800a24818305e8a52761b05f87e13206689 (patch)
tree5940cd74a000890dfbb1e078570a22d21aada3c7 /tests
parent55b6a4fa7ba6fd905a24b01955d1ddafad0cc692 (diff)
fix article enhancers by providing the correct useragent
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/articleenhancer/XPathArticleEnhancerTest.php46
1 files changed, 38 insertions, 8 deletions
diff --git a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
index 65e16fb4b..c7e61e7b8 100644
--- a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
+++ b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
@@ -35,6 +35,9 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
private $testEnhancer;
private $fileFactory;
private $timeout;
+ private $redirects;
+ private $headers;
+ private $userAgent;
protected function setUp() {
$timeout = 30;
@@ -52,6 +55,9 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
),
$this->timeout
);
+ $this->redirects = 5;
+ $this->headers = null;
+ $this->userAgent = 'Mozilla/5.0 AppleWebKit';
}
@@ -80,7 +86,10 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
$this->fileFactory->expects($this->once())
->method('getFile')
->with($this->equalTo($item->getUrl()),
- $this->equalTo($this->timeout))
+ $this->equalTo($this->timeout),
+ $this->equalTo($this->redirects),
+ $this->equalTo($this->headers),
+ $this->equalTo($this->userAgent))
->will($this->returnValue($file));
$result = $this->testEnhancer->enhance($item);
@@ -106,7 +115,10 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
$this->fileFactory->expects($this->once())
->method('getFile')
->with($this->equalTo($item->getUrl()),
- $this->equalTo($this->timeout))
+ $this->equalTo($this->timeout),
+ $this->equalTo($this->redirects),
+ $this->equalTo($this->headers),
+ $this->equalTo($this->userAgent))
->will($this->returnValue($file));
$result = $this->testEnhancer->enhance($item);
@@ -130,7 +142,10 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
$this->fileFactory->expects($this->once())
->method('getFile')
->with($this->equalTo($item->getUrl()),
- $this->equalTo($this->timeout))
+ $this->equalTo($this->timeout),
+ $this->equalTo($this->redirects),
+ $this->equalTo($this->headers),
+ $this->equalTo($this->userAgent))
->will($this->returnValue($file));
$result = $this->testEnhancer->enhance($item);
@@ -149,7 +164,10 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
$this->fileFactory->expects($this->once())
->method('getFile')
->with($this->equalTo($item->getUrl()),
- $this->equalTo($this->timeout))
+ $this->equalTo($this->timeout),
+ $this->equalTo($this->redirects),
+ $this->equalTo($this->headers),
+ $this->equalTo($this->userAgent))
->will($this->returnValue($file));
$result = $this->testEnhancer->enhance($item);
@@ -173,7 +191,10 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
$this->fileFactory->expects($this->once())
->method('getFile')
->with($this->equalTo($item->getUrl()),
- $this->equalTo($this->timeout))
+ $this->equalTo($this->timeout),
+ $this->equalTo($this->redirects),
+ $this->equalTo($this->headers),
+ $this->equalTo($this->userAgent))
->will($this->returnValue($file));
$result = $this->testEnhancer->enhance($item);
@@ -198,7 +219,10 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
$this->fileFactory->expects($this->once())
->method('getFile')
->with($this->equalTo($item->getUrl()),
- $this->equalTo($this->timeout))
+ $this->equalTo($this->timeout),
+ $this->equalTo($this->redirects),
+ $this->equalTo($this->headers),
+ $this->equalTo($this->userAgent))
->will($this->returnValue($file));
$result = $this->testEnhancer->enhance($item);
@@ -220,7 +244,10 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
$this->fileFactory->expects($this->once())
->method('getFile')
->with($this->equalTo($item->getUrl()),
- $this->equalTo($this->timeout))
+ $this->equalTo($this->timeout),
+ $this->equalTo($this->redirects),
+ $this->equalTo($this->headers),
+ $this->equalTo($this->userAgent))
->will($this->returnValue($file));
$result = $this->testEnhancer->enhance($item);
@@ -243,7 +270,10 @@ class XPathArticleEnhancerTest extends \OCA\AppFramework\Utility\TestUtility {
$this->fileFactory->expects($this->once())
->method('getFile')
->with($this->equalTo($item->getUrl()),
- $this->equalTo($this->timeout))
+ $this->equalTo($this->timeout),
+ $this->equalTo($this->redirects),
+ $this->equalTo($this->headers),
+ $this->equalTo($this->userAgent))
->will($this->returnValue($file));
$result = $this->testEnhancer->enhance($item);