summaryrefslogtreecommitdiffstats
path: root/tests/Unit/Controller/UtilityApiControllerTest.php
diff options
context:
space:
mode:
authorDavid Guillot <david@guillot.me>2018-06-30 23:57:42 +0200
committerDavid Guillot <david@guillot.me>2018-07-01 23:03:36 +0200
commit5c4185e22155687740e44d58c5c6bc9dc793cab7 (patch)
tree31ce8eee7d102d43f5e0c9e6ca21edef0cdf919c /tests/Unit/Controller/UtilityApiControllerTest.php
parenta84e80131a891184e234ddeee1ba0606ea898d7b (diff)
test(api): adapt tests to previous change
All API controllers unit tests now mock IUserSession and IUser to match new expectations
Diffstat (limited to 'tests/Unit/Controller/UtilityApiControllerTest.php')
-rw-r--r--tests/Unit/Controller/UtilityApiControllerTest.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/Unit/Controller/UtilityApiControllerTest.php b/tests/Unit/Controller/UtilityApiControllerTest.php
index 6237f3c8e..172932b0e 100644
--- a/tests/Unit/Controller/UtilityApiControllerTest.php
+++ b/tests/Unit/Controller/UtilityApiControllerTest.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;
@@ -20,6 +22,8 @@ class UtilityApiControllerTest extends \PHPUnit_Framework_TestCase
private $settings;
private $request;
+ private $userSession;
+ private $user;
private $newsAPI;
private $updater;
private $appName;
@@ -38,6 +42,19 @@ class UtilityApiControllerTest 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->updater = $this->getMockBuilder(
'\OCA\News\Utility\Updater'
)
@@ -49,8 +66,8 @@ class UtilityApiControllerTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$this->newsAPI = new UtilityApiController(
- $this->appName, $this->request, $this->updater, $this->settings,
- $this->status
+ $this->appName, $this->request, $this->userSession,
+ $this->updater, $this->settings, $this->status
);
}