summaryrefslogtreecommitdiffstats
path: root/tests/unit/articleenhancer/EnhancerTest.php
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-08-10 20:20:30 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2015-08-12 17:05:18 +0200
commit53679811da855acf9bd944a389a48399ca5d5a15 (patch)
treefa75e06a965fb5751017288a5c135bc179574210 /tests/unit/articleenhancer/EnhancerTest.php
parentc77a6705d34c81cb933f3d4b83eb18e2b586035a (diff)
serverside full text
remove enhancers add full text client side implementation fix bugs and tests for full text feed
Diffstat (limited to 'tests/unit/articleenhancer/EnhancerTest.php')
-rw-r--r--tests/unit/articleenhancer/EnhancerTest.php102
1 files changed, 0 insertions, 102 deletions
diff --git a/tests/unit/articleenhancer/EnhancerTest.php b/tests/unit/articleenhancer/EnhancerTest.php
deleted file mode 100644
index f7dc2246e..000000000
--- a/tests/unit/articleenhancer/EnhancerTest.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-/**
- * ownCloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
- */
-
-namespace OCA\News\ArticleEnhancer;
-
-use \OCA\News\Db\Item;
-
-
-class AddEnhancer implements ArticleEnhancer {
- public function enhance(Item $item) {
- $body = $item->getBody();
- $item->setBody($body += 1);
- return $item;
- }
-}
-
-
-class EnhancerTest extends \PHPUnit_Framework_TestCase {
-
- private $enhancer;
- private $articleEnhancer;
- private $articleEnhancer2;
-
- protected function setUp(){
- $this->enhancer = new Enhancer();
- $this->articleEnhancer = $this->getMockBuilder(
- '\OCA\News\ArticleEnhancer\ArticleEnhancer')
- ->disableOriginalConstructor()
- ->getMock();
- $this->enhancer->registerEnhancer('test.com', $this->articleEnhancer);
- }
-
-
- public function testEnhanceSetsCorrectHash(){
- $item = new Item();
- $item->setUrl('hi');
- $urls = [
- 'https://test.com',
- 'https://www.test.com',
- 'https://test.com/',
- 'http://test.com',
- 'http://test.com/',
- 'http://www.test.com'
- ];
- $count = count($urls);
- for ($i=0; $i < $count; $i++) {
- $this->articleEnhancer->expects($this->at($i))
- ->method('enhance')
- ->with($this->equalTo($item))
- ->will($this->returnValue($item));
- }
-
- for ($i=0; $i < $count; $i++) {
- $url = $urls[$i];
- $result = $this->enhancer->enhance($item, $url);
- $this->assertEquals($item, $result);
- }
-
- }
-
-
- public function testNotMatchShouldJustReturnItem() {
- $item = new Item();
- $item->setUrl('hi');
-
- $url = 'https://tests.com';
- $this->articleEnhancer->expects($this->never())
- ->method('enhance');
-
- $result = $this->enhancer->enhance($item, $url);
- $this->assertEquals($item, $result);
- }
-
-
- public function testGlobalEnhancer() {
- $this->enhancer->registerGlobalEnhancer(
- new AddEnhancer()
- );
-
- $this->enhancer->registerGlobalEnhancer(
- new AddEnhancer()
- );
-
- $item = new Item();
- $item->setBody(1);
-
- $result = $this->enhancer->enhance($item, 'test');
-
- $this->assertEquals(3, $result->getBody());
- }
-
-} \ No newline at end of file