зеркало из https://github.com/nextcloud/news.git
welcome in the age of newness
This commit is contained in:
Родитель
ef2af010a6
Коммит
964383cc7a
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace OCA\News;
|
||||
|
||||
require_once \OC_App::getAppPath('news') . '/appinfo/bootstrap.php';
|
||||
|
||||
|
||||
\OCP\App::addNavigationEntry( array(
|
||||
|
@ -22,10 +21,10 @@ require_once \OC_App::getAppPath('news') . '/appinfo/bootstrap.php';
|
|||
'icon' => \OC_Helper::imagePath( 'news', 'news.svg' ),
|
||||
'name' => \OC_L10N::get('news')->t('News')
|
||||
));
|
||||
|
||||
/*
|
||||
\OC_Search::registerProvider('OC_Search_Provider_News');
|
||||
|
||||
\OCP\Backgroundjob::addRegularTask( 'OCA\News\Backgroundjob', 'run' );
|
||||
\OCP\Share::registerBackend('news_item', 'OCA\News\Share_Backend_News_Item');
|
||||
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,139 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* ownCloud - News app
|
||||
*
|
||||
* @author Alessandro Cosentino
|
||||
* @author Bernhard Posselt
|
||||
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
|
||||
* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or later.
|
||||
* See the COPYING-README file
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News;
|
||||
|
||||
\OC::$CLASSPATH['Pimple'] = 'apps/news/3rdparty/Pimple/Pimple.php';
|
||||
|
||||
\OC::$CLASSPATH['OC_Search_Provider_News'] = 'apps/news/lib/search.php';
|
||||
\OC::$CLASSPATH['OCA\News\Backgroundjob'] = 'apps/news/lib/backgroundjob.php';
|
||||
\OC::$CLASSPATH['OCA\News\Share_Backend_News_Item'] = 'apps/news/lib/share/item.php';
|
||||
\OC::$CLASSPATH['OCA\News\Utils'] = 'apps/news/lib/utils.php';
|
||||
\OC::$CLASSPATH['OCA\News\Security'] = 'apps/news/lib/security.php';
|
||||
\OC::$CLASSPATH['OCA\News\API'] = 'apps/news/lib/api.php';
|
||||
\OC::$CLASSPATH['OCA\News\Request'] = 'apps/news/lib/request.php';
|
||||
\OC::$CLASSPATH['OCA\News\TemplateResponse'] = 'apps/news/lib/response.php';
|
||||
\OC::$CLASSPATH['OCA\News\JSONResponse'] = 'apps/news/lib/response.php';
|
||||
\OC::$CLASSPATH['OCA\News\TextDownloadResponse'] = 'apps/news/lib/response.php';
|
||||
\OC::$CLASSPATH['OCA\News\Controller'] = 'apps/news/lib/controller.php';
|
||||
|
||||
\OC::$CLASSPATH['OCA\News\OPMLParser'] = 'apps/news/opmlparser.php';
|
||||
\OC::$CLASSPATH['OCA\News\OPMLExporter'] = 'apps/news/opmlexporter.php';
|
||||
\OC::$CLASSPATH['OCA\News\OPMLImporter'] = 'apps/news/opmlimporter.php';
|
||||
|
||||
\OC::$CLASSPATH['OCA\News\Enclosure'] = 'apps/news/db/enclosure.php';
|
||||
\OC::$CLASSPATH['OCA\News\FeedMapper'] = 'apps/news/db/feedmapper.php';
|
||||
\OC::$CLASSPATH['OCA\News\ItemMapper'] = 'apps/news/db/itemmapper.php';
|
||||
\OC::$CLASSPATH['OCA\News\FolderMapper'] = 'apps/news/db/foldermapper.php';
|
||||
\OC::$CLASSPATH['OCA\News\Folder'] = 'apps/news/db/folder.php';
|
||||
\OC::$CLASSPATH['OCA\News\Feed'] = 'apps/news/db/feed.php';
|
||||
\OC::$CLASSPATH['OCA\News\Item'] = 'apps/news/db/item.php';
|
||||
\OC::$CLASSPATH['OCA\News\Collection'] = 'apps/news/db/collection.php';
|
||||
\OC::$CLASSPATH['OCA\News\FeedType'] = 'apps/news/db/feedtype.php';
|
||||
\OC::$CLASSPATH['OCA\News\StatusFlag'] = 'apps/news/db/statusflag.php';
|
||||
|
||||
\OC::$CLASSPATH['OCA\News\NewsController'] = 'apps/news/controller/news.controller.php';
|
||||
\OC::$CLASSPATH['OCA\News\NewsAjaxController'] = 'apps/news/controller/news.ajax.controller.php';
|
||||
|
||||
\OC::$CLASSPATH['OCA\News\FolderBl'] = 'apps/news/folder.bl.php';
|
||||
\OC::$CLASSPATH['OCA\News\FeedBl'] = 'apps/news/feed.bl.php';
|
||||
|
||||
\OC::$CLASSPATH['OCA\News\FolderApi'] = 'apps/news/external_api/folder.php';
|
||||
\OC::$CLASSPATH['OCA\News\FeedApi'] = 'apps/news/external_api/feed.php';
|
||||
|
||||
|
||||
/**
|
||||
* @return a new DI container with prefilled values for the news app
|
||||
*/
|
||||
function createDIContainer(){
|
||||
$newsContainer = new \Pimple();
|
||||
|
||||
/**
|
||||
* CONSTANTS
|
||||
*/
|
||||
$newsContainer['AppName'] = 'news';
|
||||
|
||||
|
||||
/**
|
||||
* CLASSES
|
||||
*/
|
||||
$newsContainer['API'] = $newsContainer->share(function($c){
|
||||
return new API($c['AppName']);
|
||||
});
|
||||
|
||||
|
||||
$newsContainer['Request'] = $newsContainer->share(function($c){
|
||||
return new Request($_GET, $_POST, $_FILES);
|
||||
});
|
||||
|
||||
|
||||
$newsContainer['Security'] = $newsContainer->share(function($c) {
|
||||
return new Security($c['AppName']);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* MAPPERS
|
||||
*/
|
||||
$newsContainer['ItemMapper'] = $newsContainer->share(function($c){
|
||||
return new ItemMapper($c['API']->getUserId());
|
||||
});
|
||||
|
||||
$newsContainer['FeedMapper'] = $newsContainer->share(function($c){
|
||||
return new FeedMapper($c['API']->getUserId());
|
||||
});
|
||||
|
||||
$newsContainer['FolderMapper'] = $newsContainer->share(function($c){
|
||||
return new FolderMapper($c['API']->getUserId());
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* CONTROLLERS
|
||||
*/
|
||||
$newsContainer['NewsController'] = function($c){
|
||||
return new NewsController($c['Request'], $c['API'], $c['FeedMapper'],
|
||||
$c['FolderMapper']);
|
||||
};
|
||||
|
||||
$newsContainer['NewsAjaxController'] = function($c){
|
||||
return new NewsAjaxController($c['Request'], $c['API'], $c['FeedMapper'],
|
||||
$c['FolderMapper'], $c['ItemMapper']);
|
||||
};
|
||||
|
||||
/**
|
||||
* BUSINESS LAYER OBJECTS
|
||||
*/
|
||||
$newsContainer['FolderBl'] = $newsContainer->share(function($c){
|
||||
return new FolderBl($c['FolderMapper']);
|
||||
});
|
||||
|
||||
$newsContainer['FeedBl'] = $newsContainer->share(function($c){
|
||||
return new FeedBl($c['FeedMapper']);
|
||||
});
|
||||
|
||||
/**
|
||||
* EXTERNAL API LAYER
|
||||
*/
|
||||
$newsContainer['FolderApi'] = $newsContainer->share(function($c){
|
||||
return new FolderApi($c['FolderBl']);
|
||||
});
|
||||
|
||||
$newsContainer['FeedApi'] = $newsContainer->share(function($c){
|
||||
return new FeedApi($c['FeedBl']);
|
||||
});
|
||||
|
||||
|
||||
return $newsContainer;
|
||||
}
|
|
@ -1,205 +1,52 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - News app
|
||||
* ownCloud - News
|
||||
*
|
||||
* @author Alessandro Cosentino
|
||||
* @author Bernhard Posselt
|
||||
* Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com>
|
||||
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
|
||||
* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or later.
|
||||
* See the COPYING-README file
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News;
|
||||
|
||||
require_once \OC_App::getAppPath('news') . '/appinfo/bootstrap.php';
|
||||
use \OCA\AppFramework\App;
|
||||
|
||||
/**
|
||||
* Shortcut for calling a controller method and printing the result
|
||||
* @param string $controllerName: the name of the controller under which it is
|
||||
* stored in the DI container
|
||||
* @param string $methodName: the method that you want to call
|
||||
* @param array $urlParams: an array with variables extracted from the routes
|
||||
* @param bool $disableAdminCheck: disables the check for adminuser rights
|
||||
* @param bool $isAjax: if the request is an ajax request
|
||||
*/
|
||||
function callController($controllerName, $methodName, $urlParams, $disableAdminCheck=true,
|
||||
$isAjax=false){
|
||||
$container = createDIContainer();
|
||||
|
||||
// run security checks
|
||||
$security = $container['Security'];
|
||||
runSecurityChecks($security, $isAjax, $disableAdminCheck);
|
||||
|
||||
// call the controller and render the page
|
||||
$controller = $container[$controllerName];
|
||||
$response = $controller->$methodName($urlParams);
|
||||
echo $response->render();
|
||||
}
|
||||
use \OCA\News\DependencyInjection\DIContainer;
|
||||
|
||||
|
||||
/**
|
||||
* Shortcut for calling an ajax controller method and printing the result
|
||||
* @param string $controllerName: the name of the controller under which it is
|
||||
* stored in the DI container
|
||||
* @param string $methodName: the method that you want to call
|
||||
* @param array $urlParams: an array with variables extracted from the routes
|
||||
* @param bool $disableAdminCheck: disables the check for adminuser rights
|
||||
*/
|
||||
function callAjaxController($controllerName, $methodName, $urlParams, $disableAdminCheck=true){
|
||||
callController($controllerName, $methodName, $urlParams, $disableAdminCheck, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs the security checks and exits on error
|
||||
* @param Security $security: the security object
|
||||
* @param bool $isAjax: if true, the ajax checks will be run, otherwise the normal
|
||||
* checks
|
||||
* @param bool $disableAdminCheck: disables the check for adminuser rights
|
||||
*/
|
||||
function runSecurityChecks($security, $isAjax=false, $disableAdminCheck=true){
|
||||
if($disableAdminCheck){
|
||||
$security->setIsAdminCheck(false);
|
||||
}
|
||||
|
||||
if($isAjax){
|
||||
$security->runAJAXChecks();
|
||||
} else {
|
||||
$security->runChecks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************
|
||||
* Define your routes here
|
||||
* Webinterface
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Normal Routes
|
||||
*/
|
||||
$this->create('news_index', '/')->action(
|
||||
$this->create('news_index', '/')->get()->action(
|
||||
function($params){
|
||||
callController('NewsController', 'index', $params, true);
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('news_index_feed', '/feed/{feedid}')->action(
|
||||
function($params){
|
||||
callController('NewsController', 'index', $params, true);
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('news_export_opml', '/export/opml')->action(
|
||||
function($params){
|
||||
callController('NewsController', 'exportOPML', $params, true);
|
||||
//App::main('FolderController', 'getAll', $params, new DIContainer());
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* AJAX Routes
|
||||
*/
|
||||
$this->create('news_ajax_init', '/ajax/init')->action(
|
||||
$this->create('news_folders', '/folders')->get()->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'init', $params);
|
||||
App::main('FolderController', 'getAll', $params, new DIContainer());
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('news_ajax_setshowall', '/ajax/setshowall')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'setShowAll', $params);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Folders
|
||||
*/
|
||||
$this->create('news_ajax_collapsefolder', '/ajax/collapsefolder')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'collapseFolder', $params);
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('news_ajax_changefoldername', '/ajax/changefoldername')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'changeFolderName', $params);
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('news_ajax_createfolder', '/ajax/createfolder')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'createFolder', $params);
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('news_ajax_deletefolder', '/ajax/deletefolder')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'deleteFolder', $params);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Feeds
|
||||
*/
|
||||
$this->create('news_ajax_loadfeed', '/ajax/loadfeed')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'loadFeed', $params);
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('news_ajax_deletefeed', '/ajax/deletefeed')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'deleteFeed', $params);
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('news_ajax_movefeedtofolder', '/ajax/movefeedtofolder')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'moveFeedToFolder', $params);
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('news_ajax_updatefeed', '/ajax/updatefeed')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'updateFeed', $params);
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('news_ajax_createfeed', '/ajax/createfeed')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'createFeed', $params);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
$this->create('news_ajax_setitemstatus', '/ajax/setitemstatus')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'setItemStatus', $params);
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('news_ajax_setallitemsread', '/ajax/setallitemsread')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'setAllItemsRead', $params);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Import stuff
|
||||
*/
|
||||
$this->create('news_ajax_importOPML', '/import')->action(
|
||||
function($params){
|
||||
callAjaxController('NewsAjaxController', 'uploadOPML', $params);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,16 +28,17 @@ namespace OCA\News\Controller;
|
|||
use \OCA\AppFramework\Controller\Controller;
|
||||
use \OCA\AppFramework\Core\API;
|
||||
use \OCA\AppFramework\Http\Request;
|
||||
use \OCA\AppFramework\Db\DoesNotExistException;
|
||||
use \OCA\AppFramework\Db\MultipleObjectsReturnedException;
|
||||
|
||||
use \OCA\News\Bl\FolderBl;
|
||||
|
||||
|
||||
class FolderController extends Controller {
|
||||
|
||||
private $folderBl;
|
||||
|
||||
public function __construct(API $api, Request $request, $folderMapper){
|
||||
public function __construct(API $api, Request $request, FolderBl $folderBl){
|
||||
parent::__construct($api, $request);
|
||||
$this->folderMapper = $folderMapper;
|
||||
$this->folderBl = $folderBl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,8 +50,11 @@ class FolderController extends Controller {
|
|||
* Returns all folders
|
||||
*/
|
||||
public function getAll(){
|
||||
$folders = $this->folderMapper->getAll();
|
||||
return $this->renderJSON($folders);
|
||||
$folders = $this->folderBl->findAll($this->api->getUserId());
|
||||
$result = array(
|
||||
'folders' => $folders
|
||||
);
|
||||
return $this->renderJSON($result);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - News
|
||||
*
|
||||
* @author Alessandro Cosentino
|
||||
* @author Bernhard Posselt
|
||||
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
|
||||
* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\News\DependencyInjection;
|
||||
|
||||
use OCA\AppFramework\DependencyInjection\DIContainer as BaseContainer;
|
||||
|
||||
use OCA\News\Controller\FolderController;
|
||||
use OCA\News\Bl\FolderBl;
|
||||
use OCA\News\Db\FolderMapper;
|
||||
|
||||
|
||||
class DIContainer extends BaseContainer {
|
||||
|
||||
|
||||
/**
|
||||
* Define your dependencies in here
|
||||
*/
|
||||
public function __construct(){
|
||||
// tell parent container about the app name
|
||||
parent::__construct('news');
|
||||
|
||||
|
||||
/**
|
||||
* CONTROLLERS
|
||||
*/
|
||||
$this['FolderController'] = $this->share(function($c){
|
||||
return new FolderController($c['API'], $c['Request'], $c['FolderBl']);
|
||||
});
|
||||
|
||||
/**
|
||||
* Business
|
||||
*/
|
||||
$this['FolderBl'] = $this->share(function($c){
|
||||
return new FolderBl($c['FolderMapper']);
|
||||
});
|
||||
|
||||
/**
|
||||
* MAPPERS
|
||||
*/
|
||||
$this['FolderMapper'] = $this->share(function($c){
|
||||
return new FolderMapper($c['API']);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,8 @@ use \OCA\AppFramework\Utility\ControllerTestUtility;
|
|||
use \OCA\AppFramework\Db\DoesNotExistException;
|
||||
use \OCA\AppFramework\Db\MultipleObjectsReturnedException;
|
||||
|
||||
use \OCA\News\Db\Folder;
|
||||
|
||||
|
||||
require_once(__DIR__ . "/../classloader.php");
|
||||
|
||||
|
@ -38,7 +40,7 @@ require_once(__DIR__ . "/../classloader.php");
|
|||
class FolderControllerTest extends ControllerTestUtility {
|
||||
|
||||
private $api;
|
||||
private $folderMapper;
|
||||
private $folderBl;
|
||||
private $request;
|
||||
private $controller;
|
||||
|
||||
|
@ -48,20 +50,21 @@ class FolderControllerTest extends ControllerTestUtility {
|
|||
*/
|
||||
public function setUp(){
|
||||
$this->api = $this->getAPIMock();
|
||||
$this->folderMapper = $this->getMock('FolderMapper',
|
||||
array('getAll', 'setCollapsed'));
|
||||
$this->folderBl = $this->getMockBuilder('\OCA\News\Bl\FolderBl')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->request = new Request();
|
||||
$this->controller = new FolderController($this->api, $this->request,
|
||||
$this->folderMapper);
|
||||
|
||||
$this->folderBl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getAll
|
||||
*/
|
||||
public function testGetAllCalled(){
|
||||
$this->folderMapper->expects($this->once())
|
||||
->method('getAll')
|
||||
$this->folderBl->expects($this->once())
|
||||
->method('findAll')
|
||||
->will($this->returnValue( array() ));
|
||||
|
||||
$this->controller->getAll();
|
||||
|
@ -70,18 +73,21 @@ class FolderControllerTest extends ControllerTestUtility {
|
|||
|
||||
public function testGetAllReturnsFolders(){
|
||||
$return = array(
|
||||
'folder1' => 'name1',
|
||||
'folder2' => 'name2'
|
||||
new Folder(),
|
||||
new Folder(),
|
||||
);
|
||||
$this->folderMapper->expects($this->once())
|
||||
->method('getAll')
|
||||
$this->folderBl->expects($this->once())
|
||||
->method('findAll')
|
||||
->will($this->returnValue($return));
|
||||
|
||||
$response = $this->controller->getAll();
|
||||
$this->assertEquals($return, $response->getParams());
|
||||
$expected = array(
|
||||
'folders' => $return
|
||||
);
|
||||
$this->assertEquals($expected, $response->getParams());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testGetAllAnnotations(){
|
||||
$methodName = 'getAll';
|
||||
$annotations = array('IsAdminExemption', 'IsSubAdminExemption', 'Ajax');
|
||||
|
@ -91,10 +97,6 @@ class FolderControllerTest extends ControllerTestUtility {
|
|||
|
||||
|
||||
public function testGetAllReturnsJSON(){
|
||||
$this->folderMapper->expects($this->once())
|
||||
->method('getAll')
|
||||
->will($this->returnValue( array() ));
|
||||
|
||||
$response = $this->controller->getAll();
|
||||
|
||||
$this->assertTrue($response instanceof JSONResponse);
|
||||
|
@ -106,7 +108,7 @@ class FolderControllerTest extends ControllerTestUtility {
|
|||
*//*
|
||||
public function testCollapseCalled(){
|
||||
$urlParams = array('folderId' => 1);
|
||||
$this->folderMapper->expects($this->once())
|
||||
$this->folderBl->expects($this->once())
|
||||
->method('setCollapsed')
|
||||
->with($this->equalTo($urlParams['folderId']), $this->equalTo(true));
|
||||
$this->controller->setURLParams($urlParams);
|
||||
|
@ -117,7 +119,7 @@ class FolderControllerTest extends ControllerTestUtility {
|
|||
|
||||
public function testCollapseReturnsNoParams(){
|
||||
$urlParams = array('folderId' => 1);
|
||||
$this->folderMapper->expects($this->once())
|
||||
$this->folderBl->expects($this->once())
|
||||
->method('setCollapsed')
|
||||
->with($this->equalTo($urlParams['folderId']), $this->equalTo(true));
|
||||
$this->controller->setURLParams($urlParams);
|
||||
|
@ -137,7 +139,7 @@ class FolderControllerTest extends ControllerTestUtility {
|
|||
|
||||
public function testCollapseReturnsJSON(){
|
||||
$urlParams = array('folderId' => 1);
|
||||
$this->folderMapper->expects($this->once())
|
||||
$this->folderBl->expects($this->once())
|
||||
->method('setCollapsed')
|
||||
->with($this->equalTo($urlParams['folderId']), $this->equalTo(true));
|
||||
$this->controller->setURLParams($urlParams);
|
||||
|
@ -150,7 +152,7 @@ class FolderControllerTest extends ControllerTestUtility {
|
|||
|
||||
private function collapseException($ex){
|
||||
$urlParams = array('folderId' => 1);
|
||||
$this->folderMapper->expects($this->once())
|
||||
$this->folderBl->expects($this->once())
|
||||
->method('setCollapsed')
|
||||
->with($this->equalTo($urlParams['folderId']), $this->equalTo(true))
|
||||
->will($this->throwException($ex));
|
||||
|
|
Загрузка…
Ссылка в новой задаче