diff options
author | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2018-07-04 08:54:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-04 08:54:08 +0200 |
commit | 53a43e9a9627536e8cbfe32896eee2f5a4f7e578 (patch) | |
tree | e7f1b0b6f4b76485201a8036da968702e81c757e | |
parent | 9e960afbd39f84101d67d36718436d66901f7363 (diff) | |
parent | 5c4185e22155687740e44d58c5c6bc9dc793cab7 (diff) |
Merge pull request #303 from David-Guillot/fix.adapt-to-new-login-flow
API: support new OC core login flow
-rw-r--r-- | lib/Controller/ApiController.php | 37 | ||||
-rw-r--r-- | lib/Controller/FeedApiController.php | 29 | ||||
-rw-r--r-- | lib/Controller/FolderApiController.php | 23 | ||||
-rw-r--r-- | lib/Controller/ItemApiController.php | 25 | ||||
-rw-r--r-- | lib/Controller/UserApiController.php | 7 | ||||
-rw-r--r-- | lib/Controller/UtilityApiController.php | 6 | ||||
-rw-r--r-- | tests/Unit/Controller/FeedApiControllerTest.php | 54 | ||||
-rw-r--r-- | tests/Unit/Controller/FolderApiControllerTest.php | 40 | ||||
-rw-r--r-- | tests/Unit/Controller/ItemApiControllerTest.php | 59 | ||||
-rw-r--r-- | tests/Unit/Controller/UtilityApiControllerTest.php | 21 |
10 files changed, 203 insertions, 98 deletions
diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index f5052b49a..d2a787a28 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -7,14 +7,17 @@ * * @author Alessandro Cosentino <cosenal@gmail.com> * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author David Guillot <david@guillot.me> * @copyright 2012 Alessandro Cosentino * @copyright 2012-2014 Bernhard Posselt + * @copyright 2018 David Guillot */ namespace OCA\News\Controller; -use OCP\IRequest; -use OCP\AppFramework\ApiController as BaseApiController; +use \OCP\IRequest; +use \OCP\IUserSession; +use \OCP\AppFramework\ApiController as BaseApiController; /** * Class ApiController @@ -24,14 +27,36 @@ use OCP\AppFramework\ApiController as BaseApiController; class ApiController extends BaseApiController { /** + * @var IUserSession + */ + private $userSession; + + /** * ApiController constructor. * - * @param string $appName The name of the app - * @param IRequest $request The request + * Stores the user session to be able to leverage the user in further methods + * + * @param string $appName The name of the app + * @param IRequest $request The request + * @param IUserSession $userSession The user session */ - public function __construct($appName, IRequest $request) - { + public function __construct($appName, IRequest $request, IUserSession $userSession) { parent::__construct($appName, $request); + $this->userSession = $userSession; + } + + /** + * @return IUser + */ + protected function getUser() { + return $this->userSession->getUser(); + } + + /** + * @return string + */ + protected function getUserId() { + return $this->getUser()->getUID(); } /** diff --git a/lib/Controller/FeedApiController.php b/lib/Controller/FeedApiController.php index 344d72bd0..2e4a85eef 100644 --- a/lib/Controller/FeedApiController.php +++ b/lib/Controller/FeedApiController.php @@ -7,14 +7,17 @@ * * @author Alessandro Cosentino <cosenal@gmail.com> * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author David Guillot <david@guillot.me> * @copyright 2012 Alessandro Cosentino * @copyright 2012-2014 Bernhard Posselt + * @copyright 2018 David Guillot */ namespace OCA\News\Controller; use \OCP\IRequest; use \OCP\ILogger; +use \OCP\IUserSession; use \OCP\AppFramework\Http; use \OCA\News\Service\FeedService; @@ -30,23 +33,21 @@ class FeedApiController extends ApiController private $itemService; private $feedService; - private $userId; private $logger; private $loggerParams; private $serializer; public function __construct($appName, IRequest $request, + IUserSession $userSession, FeedService $feedService, ItemService $itemService, ILogger $logger, - $UserId, $LoggerParameters ) { - parent::__construct($appName, $request); + parent::__construct($appName, $request, $userSession); $this->feedService = $feedService; $this->itemService = $itemService; - $this->userId = $UserId; $this->logger = $logger; $this->loggerParams = $LoggerParameters; $this->serializer = new EntityApiSerializer('feeds'); @@ -62,14 +63,14 @@ class FeedApiController extends ApiController { $result = [ - 'starredCount' => $this->itemService->starredCount($this->userId), - 'feeds' => $this->feedService->findAll($this->userId) + 'starredCount' => $this->itemService->starredCount($this->getUserId()), + 'feeds' => $this->feedService->findAll($this->getUserId()) ]; try { $result['newestItemId'] = - $this->itemService->getNewestItemId($this->userId); + $this->itemService->getNewestItemId($this->getUserId()); // in case there are no items, ignore } catch(ServiceNotFoundException $ex) { @@ -91,14 +92,14 @@ class FeedApiController extends ApiController public function create($url, $folderId=0) { try { - $this->feedService->purgeDeleted($this->userId, false); + $this->feedService->purgeDeleted($this->getUserId(), false); - $feed = $this->feedService->create($url, $folderId, $this->userId); + $feed = $this->feedService->create($url, $folderId, $this->getUserId()); $result = ['feeds' => [$feed]]; try { $result['newestItemId'] = - $this->itemService->getNewestItemId($this->userId); + $this->itemService->getNewestItemId($this->getUserId()); // in case there are no items, ignore } catch(ServiceNotFoundException $ex) { @@ -125,7 +126,7 @@ class FeedApiController extends ApiController public function delete($feedId) { try { - $this->feedService->delete($feedId, $this->userId); + $this->feedService->delete($feedId, $this->getUserId()); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } @@ -144,7 +145,7 @@ class FeedApiController extends ApiController */ public function read($feedId, $newestItemId) { - $this->itemService->readFeed($feedId, $newestItemId, $this->userId); + $this->itemService->readFeed($feedId, $newestItemId, $this->getUserId()); } @@ -161,7 +162,7 @@ class FeedApiController extends ApiController { try { $this->feedService->patch( - $feedId, $this->userId, ['folderId' => $folderId] + $feedId, $this->getUserId(), ['folderId' => $folderId] ); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); @@ -184,7 +185,7 @@ class FeedApiController extends ApiController { try { $this->feedService->patch( - $feedId, $this->userId, ['title' => $feedTitle] + $feedId, $this->getUserId(), ['title' => $feedTitle] ); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); diff --git a/lib/Controller/FolderApiController.php b/lib/Controller/FolderApiController.php index b24ae9acb..348fefda6 100644 --- a/lib/Controller/FolderApiController.php +++ b/lib/Controller/FolderApiController.php @@ -7,13 +7,16 @@ * * @author Alessandro Cosentino <cosenal@gmail.com> * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author David Guillot <david@guillot.me> * @copyright 2012 Alessandro Cosentino * @copyright 2012-2014 Bernhard Posselt + * @copyright 2018 David Guillot */ namespace OCA\News\Controller; use \OCP\IRequest; +use \OCP\IUserSession; use \OCP\AppFramework\Http; use \OCA\News\Service\FolderService; @@ -30,19 +33,17 @@ class FolderApiController extends ApiController private $folderService; private $itemService; - private $userId; private $serializer; public function __construct($appName, IRequest $request, + IUserSession $userSession, FolderService $folderService, - ItemService $itemService, - $UserId + ItemService $itemService ) { - parent::__construct($appName, $request); + parent::__construct($appName, $request, $userSession); $this->folderService = $folderService; $this->itemService = $itemService; - $this->userId = $UserId; $this->serializer = new EntityApiSerializer('folders'); } @@ -55,7 +56,7 @@ class FolderApiController extends ApiController public function index() { return $this->serializer->serialize( - $this->folderService->findAll($this->userId) + $this->folderService->findAll($this->getUserId()) ); } @@ -71,9 +72,9 @@ class FolderApiController extends ApiController public function create($name) { try { - $this->folderService->purgeDeleted($this->userId, false); + $this->folderService->purgeDeleted($this->getUserId(), false); return $this->serializer->serialize( - $this->folderService->create($name, $this->userId) + $this->folderService->create($name, $this->getUserId()) ); } catch(ServiceValidationException $ex) { return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY); @@ -94,7 +95,7 @@ class FolderApiController extends ApiController public function delete($folderId) { try { - $this->folderService->delete($folderId, $this->userId); + $this->folderService->delete($folderId, $this->getUserId()); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } @@ -114,7 +115,7 @@ class FolderApiController extends ApiController public function update($folderId, $name) { try { - $this->folderService->rename($folderId, $name, $this->userId); + $this->folderService->rename($folderId, $name, $this->getUserId()); } catch(ServiceValidationException $ex) { return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY); @@ -138,7 +139,7 @@ class FolderApiController extends ApiController */ public function read($folderId, $newestItemId) { - $this->itemService->readFolder($folderId, $newestItemId, $this->userId); + $this->itemService->readFolder($folderId, $newestItemId, $this->getUserId()); } diff --git a/lib/Controller/ItemApiController.php b/lib/Controller/ItemApiController.php index ae523a5f1..601a3b409 100644 --- a/lib/Controller/ItemApiController.php +++ b/lib/Controller/ItemApiController.php @@ -7,13 +7,16 @@ * * @author Alessandro Cosentino <cosenal@gmail.com> * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author David Guillot <david@guillot.me> * @copyright 2012 Alessandro Cosentino * @copyright 2012-2014 Bernhard Posselt + * @copyright 2018 David Guillot */ namespace OCA\News\Controller; use \OCP\IRequest; +use \OCP\IUserSession; use \OCP\AppFramework\Http; use \OCA\News\Service\ItemService; @@ -25,17 +28,15 @@ class ItemApiController extends ApiController use JSONHttpError; private $itemService; - private $userId; private $serializer; public function __construct($appName, IRequest $request, - ItemService $itemService, - $UserId + IUserSession $userSession, + ItemService $itemService ) { - parent::__construct($appName, $request); + parent::__construct($appName, $request, $userSession); $this->itemService = $itemService; - $this->userId = $UserId; $this->serializer = new EntityApiSerializer('items'); } @@ -59,7 +60,7 @@ class ItemApiController extends ApiController return $this->serializer->serialize( $this->itemService->findAll( $id, $type, $batchSize, $offset, $getRead, $oldestFirst, - $this->userId + $this->getUserId() ) ); } @@ -86,7 +87,7 @@ class ItemApiController extends ApiController return $this->serializer->serialize( $this->itemService->findAllNew( $id, $type, $paddedLastModified, - true, $this->userId + true, $this->getUserId() ) ); } @@ -95,7 +96,7 @@ class ItemApiController extends ApiController private function setRead($isRead, $itemId) { try { - $this->itemService->read($itemId, $isRead, $this->userId); + $this->itemService->read($itemId, $isRead, $this->getUserId()); } catch(ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); } @@ -136,7 +137,7 @@ class ItemApiController extends ApiController { try { $this->itemService->star( - $feedId, $guidHash, $isStarred, $this->userId + $feedId, $guidHash, $isStarred, $this->getUserId() ); } catch(ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); @@ -185,7 +186,7 @@ class ItemApiController extends ApiController */ public function readAll($newestItemId) { - $this->itemService->readAll($newestItemId, $this->userId); + $this->itemService->readAll($newestItemId, $this->getUserId()); } @@ -193,7 +194,7 @@ class ItemApiController extends ApiController { foreach($items as $id) { try { - $this->itemService->read($id, $isRead, $this->userId); + $this->itemService->read($id, $isRead, $this->getUserId()); } catch(ServiceNotFoundException $ex) { continue; } @@ -233,7 +234,7 @@ class ItemApiController extends ApiController try { $this->itemService->star( $item['feedId'], $item['guidHash'], - $isStarred, $this->userId + $isStarred, $this->getUserId() ); } catch(ServiceNotFoundException $ex) { continue; diff --git a/lib/Controller/UserApiController.php b/lib/Controller/UserApiController.php index cb3b8b419..2e0b04b5c 100644 --- a/lib/Controller/UserApiController.php +++ b/lib/Controller/UserApiController.php @@ -7,8 +7,10 @@ * * @author Alessandro Cosentino <cosenal@gmail.com> * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author David Guillot <david@guillot.me> * @copyright 2012 Alessandro Cosentino * @copyright 2012-2014 Bernhard Posselt + * @copyright 2018 David Guillot */ namespace OCA\News\Controller; @@ -30,8 +32,7 @@ class UserApiController extends ApiController IUserSession $userSession, IRootFolder $rootFolder ) { - parent::__construct($appName, $request); - $this->userSession = $userSession; + parent::__construct($appName, $request, $userSession); $this->rootFolder = $rootFolder; } @@ -42,7 +43,7 @@ class UserApiController extends ApiController */ public function index() { - $user = $this->userSession->getUser(); + $user = $this->getUser(); // find the avatar $jpgAvatar = '/' . $user->getUID() . '/avatar.jpg'; diff --git a/lib/Controller/UtilityApiController.php b/lib/Controller/UtilityApiController.php index 7fc6403c8..f88230c3b 100644 --- a/lib/Controller/UtilityApiController.php +++ b/lib/Controller/UtilityApiController.php @@ -7,14 +7,17 @@ * * @author Alessandro Cosentino <cosenal@gmail.com> * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author David Guillot <david@guillot.me> * @copyright 2012 Alessandro Cosentino * @copyright 2012-2014 Bernhard Posselt + * @copyright 2018 David Guillot */ namespace OCA\News\Controller; use \OCP\IRequest; use \OCP\IConfig; +use \OCP\IUserSession; use \OCP\AppFramework\Http; use \OCA\News\Utility\Updater; @@ -30,11 +33,12 @@ class UtilityApiController extends ApiController public function __construct($appName, IRequest $request, + IUserSession $userSession, Updater $updater, IConfig $settings, StatusService $statusService ) { - parent::__construct($appName, $request); + parent::__construct($appName, $request, $userSession); $this->updater = $updater; $this->settings = $settings; $this->statusService = $statusService; diff --git a/tests/Unit/Controller/FeedApiControllerTest.php b/tests/Unit/Controller/FeedApiControllerTest.php index bc91e1df8..9217014d4 100644 --- a/tests/Unit/Controller/FeedApiControllerTest.php +++ b/tests/Unit/Controller/FeedApiControllerTest.php @@ -7,8 +7,10 @@ * * @author Alessandro Cosentino <cosenal@gmail.com> * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author David Guillot <david@guillot.me> * @copyright 2012 Alessandro Cosentino * @copyright 2012-2014 Bernhard Posselt + * @copyright 2018 David Guillot */ namespace OCA\News\Tests\Unit\Controller; @@ -30,6 +32,7 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase private $itemService; private $feedAPI; private $appName; + private $userSession; private $user; private $request; private $msg; @@ -38,7 +41,6 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->user = 'tom'; $this->loggerParams = ['hi']; $this->logger = $this->getMockBuilder( '\OCP\ILogger' @@ -51,6 +53,22 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase ) ->disableOriginalConstructor() ->getMock(); + $this->userSession = $this->getMockBuilder( + '\OCP\IUserSession' + ) + ->disableOriginalConstructor() + ->getMock(); + $this->user = $this->getMockBuilder( + '\OCP\IUser' + ) + ->disableOriginalConstructor() + ->getMock(); + $this->userSession->expects($this->any()) + ->method('getUser') + ->will($this->returnValue($this->user)); + $this->user->expects($this->any()) + ->method('getUID') + ->will($this->returnValue('123')); $this->feedService = $this->getMockBuilder( '\OCA\News\Service\FeedService' ) @@ -64,10 +82,10 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase $this->feedAPI = new FeedApiController( $this->appName, $this->request, + $this->userSession, $this->feedService, $this->itemService, $this->logger, - $this->user, $this->loggerParams ); $this->msg = 'hohoho'; @@ -82,15 +100,15 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase $this->itemService->expects($this->once()) ->method('starredCount') - ->with($this->equalTo($this->user)) + ->with($this->equalTo($this->user->getUID())) ->will($this->returnValue($starredCount)); $this->itemService->expects($this->once()) ->method('getNewestItemId') - ->with($this->equalTo($this->user)) + ->with($this->equalTo($this->user->getUID())) ->will($this->returnValue($newestItemId)); $this->feedService->expects($this->once()) ->method('findAll') - ->with($this->equalTo($this->user)) + ->with($this->equalTo($this->user->getUID())) ->will($this->returnValue($feeds)); $response = $this->feedAPI->index(); @@ -112,15 +130,15 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase $this->itemService->expects($this->once()) ->method('starredCount') - ->with($this->equalTo($this->user)) + ->with($this->equalTo($this->user->getUID())) ->will($this->returnValue($starredCount)); $this->itemService->expects($this->once()) ->method('getNewestItemId') - ->with($this->equalTo($this->user)) + ->with($this->equalTo($this->user->getUID())) ->will($this->throwException(new ServiceNotFoundException(''))); $this->feedService->expects($this->once()) ->method('findAll') - ->with($this->equalTo($this->user)) + ->with($this->equalTo($this->user->getUID())) ->will($this->returnValue($feeds)); $response = $this->feedAPI->index(); @@ -140,7 +158,7 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase ->method('delete') ->with( $this->equalTo(2), - $this->equalTo($this->user) + $this->equalTo($this->user->getUID()) ); $this->feedAPI->delete(2); @@ -171,13 +189,13 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase $this->feedService->expects($this->once()) ->method('purgeDeleted') - ->with($this->equalTo($this->user), $this->equalTo(false)); + ->with($this->equalTo($this->user->getUID()), $this->equalTo(false)); $this->feedService->expects($this->once()) ->method('create') ->with( $this->equalTo('url'), $this->equalTo(3), - $this->equalTo($this->user) + $this->equalTo($this->user->getUID()) ) ->will($this->returnValue($feeds[0])); $this->itemService->expects($this->once()) @@ -201,13 +219,13 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase $this->feedService->expects($this->once()) ->method('purgeDeleted') - ->with($this->equalTo($this->user), $this->equalTo(false)); + ->with($this->equalTo($this->user->getUID()), $this->equalTo(false)); $this->feedService->expects($this->once()) ->method('create') ->with( $this->equalTo('ho'), $this->equalTo(3), - $this->equalTo($this->user) + $this->equalTo($this->user->getUID()) ) ->will($this->returnValue($feeds[0])); $this->itemService->expects($this->once()) @@ -229,7 +247,7 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase { $this->feedService->expects($this->once()) ->method('purgeDeleted') - ->with($this->equalTo($this->user), $this->equalTo(false)); + ->with($this->equalTo($this->user->getUID()), $this->equalTo(false)); $this->feedService->expects($this->once()) ->method('create') ->will( @@ -267,7 +285,7 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase ->with( $this->equalTo(3), $this->equalTo(30), - $this->equalTo($this->user) + $this->equalTo($this->user->getUID()) ); $this->feedAPI->read(3, 30); @@ -280,7 +298,7 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase ->method('patch') ->with( $this->equalTo(3), - $this->equalTo($this->user), + $this->equalTo($this->user->getUID()), $this->equalTo(['folderId' => 30]) ); @@ -313,7 +331,7 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase ->method('patch') ->with( $this->equalTo($feedId), - $this->equalTo($this->user), + $this->equalTo($this->user->getUID()), $this->equalTo(['title' => $feedTitle]) ); @@ -330,7 +348,7 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase ->method('patch') ->with( $this->equalTo($feedId), - $this->equalTo($this->user), + $this->equalTo($this->user->getUID()), $this->equalTo(['title' => $feedTitle]) ) ->will($this->throwException(new ServiceNotFoundException('hi'))); diff --git a/tests/Unit/Controller/FolderApiControllerTest.php b/tests/Unit/Controller/FolderApiControllerTest.php index 5a7fc3f93..1a3816b7b 100644 --- a/tests/Unit/Controller/FolderApiControllerTest.php +++ b/tests/Unit/Controller/FolderApiControllerTest.php @@ -7,8 +7,10 @@ * * @author Alessandro Cosentino <cosenal@gmail.com> * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author David Guillot <david@guillot.me> * @copyright 2012 Alessandro Cosentino * @copyright 2012-2014 Bernhard Posselt + * @copyright 2018 David Guillot */ namespace OCA\News\Tests\Unit\Controller; @@ -33,6 +35,7 @@ class FolderApiControllerTest extends \PHPUnit_Framework_TestCase private $itemService; private $folderAPI; private $appName; + private $userSession; private $user; private $request; private $msg; @@ -40,12 +43,27 @@ class FolderApiControllerTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->appName = 'news'; - $this->user = 'tom'; $this->request = $this->getMockBuilder( '\OCP\IRequest' ) ->disableOriginalConstructor() ->getMock(); + $this->userSession = $this->getMockBuilder( + '\OCP\IUserSession' + ) + ->disableOriginalConstructor() + ->getMock(); + $this->user = $this->getMockBuilder( + '\OCP\IUser' + ) + ->disableOriginalConstructor() + ->getMock(); + $this->userSession->expects($this->any()) + ->method('getUser') + ->will($this->returnValue($this->user)); + $this->user->expects($this->any()) + ->method('getUID') + ->will($this->returnValue('123')); $this->folderService = $this->getMockBuilder( '\OCA\News\Service\FolderService' ) @@ -59,9 +77,9 @@ class FolderApiControllerTest extends \PHPUnit_Framework_TestCase $this->folderAPI = new FolderApiController( $this->appName, $this->request, + $this->userSession, $this->folderService, - $this->itemService, - $this->user + $this->itemService ); $this->msg = 'test'; } @@ -73,7 +91,7 @@ class FolderApiControllerTest extends \PHPUnit_Framework_TestCase $this->folderService->expects($this->once()) ->method('findAll') - ->with($this->equalTo($this->user)) + ->with($this->equalTo($this->user->getUID())) ->will($this->returnValue($folders)); $response = $this->folderAPI->index(); @@ -94,10 +112,10 @@ class FolderApiControllerTest extends \PHPUnit_Framework_TestCase $this->folderService->expects($this->once()) ->method('purgeDeleted') - ->with($this->equalTo($this->user), $this->equalTo(false)); + ->with($this->equalTo($this->user->getUID()), $this->equalTo(false)); $this->folderService->expects($this->once()) ->method('create') - ->with($this->equalTo($folderName), $this->equalTo($this->user)) + ->with($this->equalTo($folderName), $this->equalTo($this->user->getUID())) ->will($this->returnValue($folder)); $response = $this->folderAPI->create($folderName); @@ -116,7 +134,7 @@ class FolderApiControllerTest extends \PHPUnit_Framework_TestCase $this->folderService->expects($this->once()) ->method('purgeDeleted') - ->with($this->equalTo($this->user), $this->equalTo(false)); + ->with($this->equalTo($this->user->getUID()), $this->equalTo(false)); $this->folderService->expects($this->once()) ->method('create') ->will($this->throwException(new ServiceConflictException($msg))); @@ -135 |