summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-04-09 16:10:48 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-04-09 22:52:27 +0200
commit643fa4624dd7ba2db1349f16131bf330aeee3387 (patch)
tree73bc787a3eb1ed5f53ab932187546c980ac50bb5 /tests
parentefe9db1e064c9736fe35c27040ee60fa28ca8d4d (diff)
port to internal controller, some routes are still broken
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/articleenhancer/XPathArticleEnhancerTest.php11
-rw-r--r--tests/unit/businesslayer/FeedBusinessLayerTest.php15
-rw-r--r--tests/unit/businesslayer/FolderBusinessLayerTest.php14
-rw-r--r--tests/unit/businesslayer/ItemBusinessLayerTest.php14
-rw-r--r--tests/unit/controller/ApiControllerTest.php (renamed from tests/unit/api/NewsAPITest.php)10
-rw-r--r--tests/unit/controller/FeedApiControllerTest.php (renamed from tests/unit/api/FeedAPITest.php)40
-rw-r--r--tests/unit/controller/FeedControllerTest.php20
-rw-r--r--tests/unit/controller/FolderApiControllerTest.php (renamed from tests/unit/api/FolderAPITest.php)30
-rw-r--r--tests/unit/controller/FolderControllerTest.php6
-rw-r--r--tests/unit/controller/ItemApiControllerTest.php (renamed from tests/unit/api/ItemAPITest.php)54
-rw-r--r--tests/unit/controller/ItemControllerTest.php10
-rw-r--r--tests/unit/fetcher/FeedFetcherTest.php18
12 files changed, 134 insertions, 108 deletions
diff --git a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
index e594e105f..a600d6739 100644
--- a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
+++ b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
@@ -40,10 +40,17 @@ class XPathArticleEnhancerTest extends \OCA\News\Utility\TestUtility {
private $userAgent;
protected function setUp() {
- $timeout = 30;
+ $this->timeout = 30;
$this->fileFactory = $this->getMockBuilder('\OCA\News\Utility\SimplePieAPIFactory')
->disableOriginalConstructor()
->getMock();
+ $config = $this->getMockBuilder(
+ '\OCA\News\Utility\Config')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $config->expects($this->any())
+ ->method('getFeedFetcherTimeout')
+ ->will($this->returnValue($this->timeout));
$this->testEnhancer = new XPathArticleEnhancer(
$this->fileFactory,
@@ -53,7 +60,7 @@ class XPathArticleEnhancerTest extends \OCA\News\Utility\TestUtility {
'/explosm.net\/all/' => '//body/*',
'/themerepublic.net/' => '//*[@class=\'post hentry\']'
),
- $this->timeout
+ $config
);
$this->redirects = 5;
$this->headers = null;
diff --git a/tests/unit/businesslayer/FeedBusinessLayerTest.php b/tests/unit/businesslayer/FeedBusinessLayerTest.php
index 4e35326d6..19ff7da7f 100644
--- a/tests/unit/businesslayer/FeedBusinessLayerTest.php
+++ b/tests/unit/businesslayer/FeedBusinessLayerTest.php
@@ -53,10 +53,7 @@ class FeedBusinessLayerTest extends \OCA\News\Utility\TestUtility {
$this->api = $this->getAPIMock();
$this->time = 222;
$this->autoPurgeMinimumInterval = 10;
- $timeFactory = $this->getMockBuilder(
- '\OCA\News\Utility\TimeFactory')
- ->disableOriginalConstructor()
- ->getMock();
+ $timeFactory = $this->getMock('TimeFactory', array('getTime'));
$timeFactory->expects($this->any())
->method('getTime')
->will($this->returnValue($this->time));
@@ -73,9 +70,17 @@ class FeedBusinessLayerTest extends \OCA\News\Utility\TestUtility {
->disableOriginalConstructor()
->getMock();
$this->purifier = $this->getMock('purifier', array('purify'));
+ $config = $this->getMockBuilder(
+ '\OCA\News\Utility\Config')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $config->expects($this->any())
+ ->method('getAutoPurgeMinimumInterval')
+ ->will($this->returnValue($this->autoPurgeMinimumInterval));
+
$this->feedBusinessLayer = new FeedBusinessLayer($this->feedMapper,
$this->fetcher, $this->itemMapper, $this->api,
- $timeFactory, $this->autoPurgeMinimumInterval,
+ $timeFactory, $config,
$this->enhancer, $this->purifier);
$this->user = 'jack';
$response = 'hi';
diff --git a/tests/unit/businesslayer/FolderBusinessLayerTest.php b/tests/unit/businesslayer/FolderBusinessLayerTest.php
index c68d0e768..17eb1b8ae 100644
--- a/tests/unit/businesslayer/FolderBusinessLayerTest.php
+++ b/tests/unit/businesslayer/FolderBusinessLayerTest.php
@@ -42,10 +42,7 @@ class FolderBusinessLayerTest extends \OCA\News\Utility\TestUtility {
protected function setUp(){
$this->api = $this->getAPIMock();
$this->time = 222;
- $timeFactory = $this->getMockBuilder(
- '\OCA\News\Utility\TimeFactory')
- ->disableOriginalConstructor()
- ->getMock();
+ $timeFactory = $this->getMock('TimeFactory', array('getTime'));
$timeFactory->expects($this->any())
->method('getTime')
->will($this->returnValue($this->time));
@@ -54,9 +51,16 @@ class FolderBusinessLayerTest extends \OCA\News\Utility\TestUtility {
->disableOriginalConstructor()
->getMock();
$this->autoPurgeMinimumInterval = 10;
+ $config = $this->getMockBuilder(
+ '\OCA\News\Utility\Config')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $config->expects($this->any())
+ ->method('getAutoPurgeMinimumInterval')
+ ->will($this->returnValue($this->autoPurgeMinimumInterval));
$this->folderBusinessLayer = new FolderBusinessLayer(
$this->folderMapper, $this->api, $timeFactory,
- $this->autoPurgeMinimumInterval);
+ $config);
$this->user = 'hi';
}
diff --git a/tests/unit/businesslayer/ItemBusinessLayerTest.php b/tests/unit/businesslayer/ItemBusinessLayerTest.php
index 349ad865c..a3e7f7a14 100644
--- a/tests/unit/businesslayer/ItemBusinessLayerTest.php
+++ b/tests/unit/businesslayer/ItemBusinessLayerTest.php
@@ -47,10 +47,7 @@ class ItemBusinessLayerTest extends \OCA\News\Utility\TestUtility {
protected function setUp(){
$this->time = 222;
- $timeFactory = $this->getMockBuilder(
- '\OCA\News\Utility\TimeFactory')
- ->disableOriginalConstructor()
- ->getMock();
+ $timeFactory = $this->getMock('TimeFactory', array('getTime'));
$timeFactory->expects($this->any())
->method('getTime')
->will($this->returnValue($this->time));
@@ -66,8 +63,15 @@ class ItemBusinessLayerTest extends \OCA\News\Utility\TestUtility {
->method('typeToStatus')
->will($this->returnValue($this->status));
$this->threshold = 2;
+ $config = $this->getMockBuilder(
+ '\OCA\News\Utility\Config')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $config->expects($this->any())
+ ->method('getAutoPurgeCount')
+ ->will($this->returnValue($this->threshold));
$this->itemBusinessLayer = new ItemBusinessLayer($this->mapper,
- $statusFlag, $timeFactory, $this->threshold);
+ $statusFlag, $timeFactory, $config);
$this->user = 'jack';
$response = 'hi';
$this->id = 3;
diff --git a/tests/unit/api/NewsAPITest.php b/tests/unit/controller/ApiControllerTest.php
index f0aaf2411..722830a23 100644
--- a/tests/unit/api/NewsAPITest.php
+++ b/tests/unit/controller/ApiControllerTest.php
@@ -23,7 +23,7 @@
*
*/
-namespace OCA\News\API;
+namespace OCA\News\Controller;
use \OCP\IRequest;
use \OCP\AppFramework\Http\JSONResponse;
@@ -34,7 +34,7 @@ use \OCA\News\Utility\ControllerTestUtility;
require_once(__DIR__ . "/../../classloader.php");
-class NewsAPITest extends ControllerTestUtility {
+class ApiControllerTest extends ControllerTestUtility {
private $api;
private $request;
@@ -54,7 +54,7 @@ class NewsAPITest extends ControllerTestUtility {
'\OCA\News\Utility\Updater')
->disableOriginalConstructor()
->getMock();
- $this->newsAPI = new NewsAPI($this->api, $this->request, $this->updater);
+ $this->newsAPI = new ApiController($this->api, $this->request, $this->updater);
}
@@ -115,7 +115,7 @@ class NewsAPITest extends ControllerTestUtility {
public function testCors() {
$this->request = $this->getRequest(array('server' => array()));
- $this->newsAPI = new NewsAPI($this->api, $this->request, $this->updater);
+ $this->newsAPI = new ApiController($this->api, $this->request, $this->updater);
$response = $this->newsAPI->cors();
$headers = $response->getHeaders();
@@ -130,7 +130,7 @@ class NewsAPITest extends ControllerTestUtility {
public function testCorsUsesOriginIfGiven() {
$this->request = $this->getRequest(array('server' => array('HTTP_ORIGIN' => 'test')));
- $this->newsAPI = new NewsAPI($this->api, $this->request, $this->updater);
+ $this->newsAPI = new ApiController($this->api, $this->request, $this->updater);
$response = $this->newsAPI->cors();
$headers = $response->getHeaders();
diff --git a/tests/unit/api/FeedAPITest.php b/tests/unit/controller/FeedApiControllerTest.php
index 935b5214b..8bb8447bd 100644
--- a/tests/unit/api/FeedAPITest.php
+++ b/tests/unit/controller/FeedApiControllerTest.php
@@ -23,7 +23,7 @@
*
*/
-namespace OCA\News\API;
+namespace OCA\News\Controller;
use \OCP\IRequest;
use \OCP\AppFramework\Http;
@@ -39,7 +39,7 @@ use \OCA\News\Db\Item;
require_once(__DIR__ . "/../../classloader.php");
-class FeedAPITest extends ControllerTestUtility {
+class FeedApiControllerTest extends ControllerTestUtility {
private $folderBusinessLayer;
private $feedBusinessLayer;
@@ -71,7 +71,7 @@ class FeedAPITest extends ControllerTestUtility {
'\OCA\News\BusinessLayer\ItemBusinessLayer')
->disableOriginalConstructor()
->getMock();
- $this->feedAPI = new FeedAPI(
+ $this->feedAPI = new FeedApiController(
$this->api,
$this->request,
$this->folderBusinessLayer,
@@ -90,7 +90,7 @@ class FeedAPITest extends ControllerTestUtility {
public function testGetAllAnnotations(){
- $this->assertDefaultAnnotations('getAll');
+ $this->assertDefaultAnnotations('index');
}
@@ -114,9 +114,9 @@ class FeedAPITest extends ControllerTestUtility {
}
- public function testGetAllFromUsersAnnotations(){
+ public function testFromUsersAnnotations(){
$annotations = array('NoCSRFRequired', 'API');
- $this->assertAnnotations($this->feedAPI, 'getAllFromAllUsers', $annotations);
+ $this->assertAnnotations($this->feedAPI, 'fromAllUsers', $annotations);
}
@@ -126,7 +126,7 @@ class FeedAPITest extends ControllerTestUtility {
}
- public function testGetAll() {
+ public function testIndex() {
$feeds = array(
new Feed()
);
@@ -149,7 +149,7 @@ class FeedAPITest extends ControllerTestUtility {
->with($this->equalTo($this->user))
->will($this->returnValue($feeds));
- $response = $this->feedAPI->getAll();
+ $response = $this->feedAPI->index();
$this->assertEquals(array(
'feeds' => array($feeds[0]->toAPI()),
@@ -159,7 +159,7 @@ class FeedAPITest extends ControllerTestUtility {
}
- public function testGetAllNoNewestItemId() {
+ public function testIndexNoNewestItemId() {
$feeds = array(
new Feed()
);
@@ -181,7 +181,7 @@ class FeedAPITest extends ControllerTestUtility {
->with($this->equalTo($this->user))
->will($this->returnValue($feeds));
- $response = $this->feedAPI->getAll();
+ $response = $this->feedAPI->index();
$this->assertEquals(array(
'feeds' => array($feeds[0]->toAPI()),
@@ -194,7 +194,7 @@ class FeedAPITest extends ControllerTestUtility {
$request = $this->getRequest(array('urlParams' => array(
'feedId' => 2
)));
- $this->feedAPI = new FeedAPI(
+ $this->feedAPI = new FeedApiController(
$this->api,
$request,
$this->folderBusinessLayer,
@@ -222,7 +222,7 @@ class FeedAPITest extends ControllerTestUtility {
$request = $this->getRequest(array('urlParams' => array(
'feedId' => 2
)));
- $this->feedAPI = new FeedAPI(
+ $this->feedAPI = new FeedApiController(
$this->api,
$request,
$this->folderBusinessLayer,
@@ -253,7 +253,7 @@ class FeedAPITest extends ControllerTestUtility {
'url' => 'ho',
'folderId' => 3
)));
- $this->feedAPI = new FeedAPI(
+ $this->feedAPI = new FeedApiController(
$this->api,
$request,
$this->folderBusinessLayer,
@@ -297,7 +297,7 @@ class FeedAPITest extends ControllerTestUtility {
'url' => 'ho',
'folderId' => 3
)));
- $this->feedAPI = new FeedAPI(
+ $this->feedAPI = new FeedApiController(
$this->api,
$request,
$this->folderBusinessLayer,
@@ -377,7 +377,7 @@ class FeedAPITest extends ControllerTestUtility {
'newestItemId' => 30,
)
));
- $this->feedAPI = new FeedAPI(
+ $this->feedAPI = new FeedApiController(
$this->api,
$request,
$this->folderBusinessLayer,
@@ -411,7 +411,7 @@ class FeedAPITest extends ControllerTestUtility {
'folderId' => 30,
)
));
- $this->feedAPI = new FeedAPI(
+ $this->feedAPI = new FeedApiController(
$this->api,
$request,
$this->folderBusinessLayer,
@@ -448,7 +448,7 @@ class FeedAPITest extends ControllerTestUtility {
'feedTitle' => $feedTitle
)
));
- $this->feedAPI = new FeedAPI(
+ $this->feedAPI = new FeedApiController(
$this->api,
$request,
$this->folderBusinessLayer,
@@ -489,7 +489,7 @@ class FeedAPITest extends ControllerTestUtility {
}
- public function testGetAllFromAllUsers(){
+ public function testfromAllUsers(){
$feed = new Feed();
$feed->setUrl(3);
$feed->setId(1);
@@ -498,7 +498,7 @@ class FeedAPITest extends ControllerTestUtility {
$this->feedBusinessLayer->expects($this->once())
->method('findAllFromAllUsers')
->will($this->returnValue($feeds));
- $response = $this->feedAPI->getAllFromAllUsers();
+ $response = $this->feedAPI->fromAllUsers();
$this->assertTrue($response instanceof JSONResponse);
$this->assertEquals('{"feeds":[{"id":1,"userId":"john"}]}', $response->render());
}
@@ -511,7 +511,7 @@ class FeedAPITest extends ControllerTestUtility {
'feedId' => $feedId,
'userId' => $userId
)));
- $this->feedAPI = new FeedAPI(
+ $this->feedAPI = new FeedApiController(
$this->api,
$request,
$this->folderBusinessLayer,
diff --git a/tests/unit/controller/FeedControllerTest.php b/tests/unit/controller/FeedControllerTest.php
index ac7b998cb..90c1b8e14 100644
--- a/tests/unit/controller/FeedControllerTest.php
+++ b/tests/unit/controller/FeedControllerTest.php
@@ -91,7 +91,7 @@ class FeedControllerTest extends ControllerTestUtility {
public function testFeedsAnnotations(){
- $this->assertFeedControllerAnnotations('feeds');
+ $this->assertFeedControllerAnnotations('index');
}
@@ -126,14 +126,14 @@ class FeedControllerTest extends ControllerTestUtility {
public function testImportArticlesAnnotations(){
- $this->assertFeedControllerAnnotations('importArticles');
+ $this->assertFeedControllerAnnotations('import');
}
public function testReadAnnotations(){
$this->assertFeedControllerAnnotations('read');
}
- public function testFeeds(){
+ public function testIndex(){
$result = array(
'feeds' => array(
array('a feed'),
@@ -156,14 +156,14 @@ class FeedControllerTest extends ControllerTestUtility {
->with($this->equalTo($this->user))
->will($this->returnValue($result['starred']));
- $response = $this->controller->feeds();
+ $response = $this->controller->index();
$this->assertEquals($result, $response->getData());
$this->assertTrue($response instanceof JSONResponse);
}
- public function testFeedsHighestItemIdExists(){
+ public function testIndexHighestItemIdExists(){
$result = array(
'feeds' => array(
array('a feed'),
@@ -187,7 +187,7 @@ class FeedControllerTest extends ControllerTestUtility {
->with($this->equalTo($this->user))
->will($this->returnValue($result['starred']));
- $response = $this->controller->feeds();
+ $response = $this->controller->index();
$this->assertEquals($result, $response->getData());
$this->assertTrue($response instanceof JSONResponse);
@@ -620,7 +620,7 @@ class FeedControllerTest extends ControllerTestUtility {
}
- public function testImportArticles() {
+ public function testImport() {
$feed = new Feed();
$post = array(
@@ -640,14 +640,14 @@ class FeedControllerTest extends ControllerTestUtility {
$this->equalTo($this->user))
->will($this->returnValue($feed));
- $response = $this->controller->importArticles();
+ $response = $this->controller->import();
$this->assertEquals($expected, $response->getData());
$this->assertTrue($response instanceof JSONResponse);
}
- public function testImportArticlesCreatesNoAdditionalFeed() {
+ public function testImportCreatesNoAdditionalFeed() {
$feed = new Feed();
$post = array(
@@ -665,7 +665,7 @@ class FeedControllerTest extends ControllerTestUtility {
$this->equalTo($this->user))
->will($this->returnValue(null));
- $response = $this->controller->importArticles();
+ $response = $this->controller->import();
$this->assertEquals($expected, $response->getData());
$this->assertTrue($response instanceof JSONResponse);
diff --git a/tests/unit/api/FolderAPITest.php b/tests/unit/controller/FolderApiControllerTest.php
index c835e4722..cc799dc18 100644
--- a/tests/unit/api/FolderAPITest.php
+++ b/tests/unit/controller/FolderApiControllerTest.php
@@ -23,7 +23,7 @@
*
*/
-namespace OCA\News\API;
+namespace OCA\News\Controller;
use \OCP\IRequest;
use \OCP\AppFramework\Http;
@@ -41,7 +41,7 @@ use \OCA\News\Db\Item;
require_once(__DIR__ . "/../../classloader.php");
-class FolderAPITest extends ControllerTestUtility {
+class FolderApiControllerTest extends ControllerTestUtility {
private $folderBusinessLayer;
private $itemBusinessLayer;
@@ -68,7 +68,7 @@ class FolderAPITest extends ControllerTestUtility {
'\OCA\News\BusinessLayer\ItemBusinessLayer')
->disableOriginalConstructor()
->getMock();
- $this->folderAPI = new FolderAPI(
+ $this->folderAPI = new FolderApiController(
$this->api,
$this->request,
$this->folderBusinessLayer,
@@ -85,8 +85,8 @@ class FolderAPITest extends ControllerTestUtility {
}
- public function testGetAllAnnotations(){
- $this->assertDefaultAnnotations('getAll');
+ public function testIndexAnnotations(){
+ $this->assertDefaultAnnotations('index');
}
@@ -110,7 +110,7 @@ class FolderAPITest extends ControllerTestUtility {
}
- public function testGetAll() {
+ public function testIndex() {
$folders = array(
new Folder()
);
@@ -123,7 +123,7 @@ class FolderAPITest extends ControllerTestUtility {
->with($this->equalTo($this->user))
->will($this->returnValue($folders));
- $response = $this->folderAPI->getAll();
+ $response = $this->folderAPI->index();
$this->assertEquals(array(
'folders' => array($folders[0]->toAPI())
@@ -138,7 +138,7 @@ class FolderAPITest extends ControllerTestUtility {
$folders = array(
$folder
);
- $this->folderAPI = new FolderAPI(
+ $this->folderAPI = new FolderApiController(
$this->api,
$this->getRequest(array('params' => array(
'name' => $folderName
@@ -211,7 +211,7 @@ class FolderAPITest extends ControllerTestUtility {
public function testDelete() {
$folderId = 23;
- $this->folderAPI = new FolderAPI(
+ $this->folderAPI = new FolderApiController(
$this->api,
$this->getRequest(array('urlParams' => array(
'folderId' => $folderId
@@ -236,7 +236,7 @@ class FolderAPITest extends ControllerTestUtility {
public function testDeleteDoesNotExist() {
$folderId = 23;
- $this->folderAPI = new FolderAPI(
+ $this->folderAPI = new FolderApiController(
$this->api,
$this->getRequest(array('urlParams' => array(
'folderId' => $folderId
@@ -264,7 +264,7 @@ class FolderAPITest extends ControllerTestUtility {
$folderId = 23;
$folderName = 'test';
- $this->folderAPI = new FolderAPI(
+ $this->folderAPI = new FolderApiController(
$this->api,
$this->getRequest(
array(
@@ -300,7 +300,7 @@ class FolderAPITest extends ControllerTestUtility {
$folderId = 23;
$folderName = 'test';
- $this->folderAPI = new FolderAPI(
+ $this->folderAPI = new FolderApiController(
$this->api,
$this->getRequest(
array(
@@ -336,7 +336,7 @@ class FolderAPITest extends ControllerTestUtility {
$folderId = 23;
$folderName = 'test';
- $this->folderAPI = new FolderAPI(
+ $this->folderAPI = new FolderApiController(
$this->api,
$this->getRequest(
array(
@@ -372,7 +372,7 @@ class FolderAPITest extends ControllerTestUtility {
$folderId = 23;
$folderName = '';
- $this->folderAPI = new FolderAPI(
+ $this->folderAPI = new FolderApiController(
$this->api,
$this->getRequest(
array(
@@ -413,7 +413,7 @@ class FolderAPITest extends ControllerTestUtility {
'newestItemId' => 30,
)
));
- $this->folderAPI = new FolderAPI(
+ $this->folderAPI = new FolderApiController(
$this->api,
$request,
$this->folderBusinessLayer,
diff --git a/tests/unit/controller/FolderControllerTest.php b/tests/unit/controller/FolderControllerTest.php
index a26fc3151..dba656e7b 100644
--- a/tests/unit/controller/FolderControllerTest.php
+++ b/tests/unit/controller/FolderControllerTest.php
@@ -94,7 +94,7 @@ class FolderControllerTest extends ControllerTestUtility {
}
public function testFoldersAnnotations(){
- $this->assertFolderControllerAnnotations('folders');
+ $this->assertFolderControllerAnnotations('index');
}
@@ -132,7 +132,7 @@ class FolderControllerTest extends ControllerTestUtility {
$this->assertFolderControllerAnnotations('read');
}
- public function testFolders(){
+ public function testIndex(){
$return = array(
new Folder(),
new Folder(),
@@ -141,7 +141,7 @@ class FolderControllerTest extends ControllerTestUtility {
->method('findAll')
->will($this->returnValue($return));
- $response = $this->controller->folders();
+ $response = $this->controller->index();
$expected = array(
'folders' => $return
);
diff --git a/tests/unit/api/ItemAPITest.php b/tests/unit/controller/ItemApiControllerTest.php
index 4c44e37f2..b0f42aae5 100644
--- a/tests/unit/api/ItemAPITest.php
+++ b/tests/unit/controller/ItemApiControllerTest.php
@@ -23,7 +23,7 @@
*
*/
-namespace OCA\News\API;
+namespace OCA\News\Controller;
use \OCP\IRequest;
use \OCP\AppFramework\Http;
@@ -36,7 +36,7 @@ use \OCA\News\Db\Item;
require_once(__DIR__ . "/../../classloader.php");
-class ItemAPITest extends ControllerTestUtility {
+class ItemApiControllerTest extends ControllerTestUtility {
private $itemBusinessLayer;
private $itemAPI;
@@ -59,7 +59,7 @@ class ItemAPITest extends ControllerTestUtility {
->disableOriginalConstructor()
->getMock();
$this->user = 'tom';
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$this->request,
$this->itemBusinessLayer
@@ -74,8 +74,8 @@ class ItemAPITest extends ControllerTestUtility {
}
- public function testGetAllAnnotations(){
- $this->assertDefaultAnnotations('getAll');
+ public function testIndexAnnotations(){
+ $this->assertDefaultAnnotations('index');
}
@@ -129,7 +129,7 @@ class ItemAPITest extends ControllerTestUtility {
}
- public function testGetAll() {
+ public function testIndex() {
$items = array(
new Item()
);
@@ -140,7 +140,7 @@ class ItemAPITest extends ControllerTestUtility {
'id' => 2,
'getRead' => 'false'
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -161,7 +161,7 @@ class ItemAPITest extends ControllerTestUtility {
)
->will($this->returnValue($items));
- $response = $this->itemAPI->getAll();
+ $response = $this->itemAPI->index();
$this->assertEquals(array(
'items' => array($items[0]->toAPI())
@@ -169,7 +169,7 @@ class ItemAPITest extends ControllerTestUtility {
}
- public function testGetAllDefaultBatchSize() {
+ public function testIndexDefaultBatchSize() {
$items = array(
new Item()
);
@@ -179,7 +179,7 @@ class ItemAPITest extends ControllerTestUtility {
'id' => 2,
'getRead' => 'false'
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -200,7 +200,7 @@ class ItemAPITest extends ControllerTestUtility {
)
->will($this->returnValue($items));
- $response = $this->itemAPI->getAll();
+ $response = $this->itemAPI->index();
$this->assertEquals(array(
'items' => array($items[0]->toAPI())
@@ -217,7 +217,7 @@ class ItemAPITest extends ControllerTestUtility {
'type' => 1,
'id' => 2,
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -249,7 +249,7 @@ class ItemAPITest extends ControllerTestUtility {
$request = $this->getRequest(array('urlParams' => array(
'itemId' => 2
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -277,7 +277,7 @@ class ItemAPITest extends ControllerTestUtility {
$request = $this->getRequest(array('urlParams' => array(
'itemId' => 2
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -302,7 +302,7 @@ class ItemAPITest extends ControllerTestUtility {
$request = $this->getRequest(array('urlParams' => array(
'itemId' => 2
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -330,7 +330,7 @@ class ItemAPITest extends ControllerTestUtility {
$request = $this->getRequest(array('urlParams' => array(
'itemId' => 2
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -356,7 +356,7 @@ class ItemAPITest extends ControllerTestUtility {
'feedId' => 2,
'guidHash' => 'hash'
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -386,7 +386,7 @@ class ItemAPITest extends ControllerTestUtility {
'feedId' => 2,
'guidHash' => 'hash'
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -412,7 +412,7 @@ class ItemAPITest extends ControllerTestUtility {
'feedId' => 2,
'guidHash' => 'hash'
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -442,7 +442,7 @@ class ItemAPITest extends ControllerTestUtility {
'feedId' => 2,
'guidHash' => 'hash'
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -469,7 +469,7 @@ class ItemAPITest extends ControllerTestUtility {
'newestItemId' => 30,
)
));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -496,7 +496,7 @@ class ItemAPITest extends ControllerTestUtility {
$request = $this->getRequest(array('params' => array(
'items' => array(2, 4)
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -524,7 +524,7 @@ class ItemAPITest extends ControllerTestUtility {
$request = $this->getRequest(array('params' => array(
'items' => array(2, 4)
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -549,7 +549,7 @@ class ItemAPITest extends ControllerTestUtility {
$request = $this->getRequest(array('params' => array(
'items' => array(2, 4)
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -586,7 +586,7 @@ class ItemAPITest extends ControllerTestUtility {
)
)
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -625,7 +625,7 @@ class ItemAPITest extends ControllerTestUtility {
)
)
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
@@ -660,7 +660,7 @@ class ItemAPITest extends ControllerTestUtility {
)
)
)));
- $this->itemAPI = new ItemAPI(
+ $this->itemAPI = new ItemApiController(
$this->api,
$request,
$this->itemBusinessLayer
diff --git a/tests/unit/controller/ItemControllerTest.php b/tests/unit/controller/ItemControllerTest.php
index 8089ed2f1..9fa2e1a63 100644
--- a/tests/unit/controller/ItemControllerTest.php
+++ b/tests/unit/controller/ItemControllerTest.php
@@ -87,7 +87,7 @@ class ItemControllerTest extends ControllerTestUtility {
public function testItemsAnnotations(){
- $this->assertItemControllerAnnotations('items');
+ $this->assertItemControllerAnnotations('index');
}
@@ -345,7 +345,7 @@ class ItemControllerTest extends ControllerTestUtility {
}
- public function testItems(){
+ public function testIndex(){
$feeds = array(new Feed());
$result = array(
'items' => array(new Item()),
@@ -389,7 +389,7 @@ class ItemControl