summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Comments/CommentsNodeTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/tests/unit/Comments/CommentsNodeTest.php')
-rw-r--r--apps/dav/tests/unit/Comments/CommentsNodeTest.php54
1 files changed, 41 insertions, 13 deletions
diff --git a/apps/dav/tests/unit/Comments/CommentsNodeTest.php b/apps/dav/tests/unit/Comments/CommentsNodeTest.php
index 18b18ab8d3b..e7b3dd548c7 100644
--- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php
+++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php
@@ -38,11 +38,21 @@ class CommentsNodeTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->commentsManager = $this->getMock('\OCP\Comments\ICommentsManager');
- $this->comment = $this->getMock('\OCP\Comments\IComment');
- $this->userManager = $this->getMock('\OCP\IUserManager');
- $this->userSession = $this->getMock('\OCP\IUserSession');
- $this->logger = $this->getMock('\OCP\ILogger');
+ $this->commentsManager = $this->getMockBuilder('\OCP\Comments\ICommentsManager')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->comment = $this->getMockBuilder('\OCP\Comments\IComment')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->userManager = $this->getMockBuilder('\OCP\IUserManager')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->userSession = $this->getMockBuilder('\OCP\IUserSession')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->logger = $this->getMockBuilder('\OCP\ILogger')
+ ->disableOriginalConstructor()
+ ->getMock();
$this->node = new CommentNode(
$this->commentsManager,
@@ -54,7 +64,9 @@ class CommentsNodeTest extends \Test\TestCase {
}
public function testDelete() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')
+ ->disableOriginalConstructor()
+ ->getMock();
$user->expects($this->once())
->method('getUID')
@@ -87,7 +99,9 @@ class CommentsNodeTest extends \Test\TestCase {
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testDeleteForbidden() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')
+ ->disableOriginalConstructor()
+ ->getMock();
$user->expects($this->once())
->method('getUID')
@@ -137,7 +151,9 @@ class CommentsNodeTest extends \Test\TestCase {
public function testUpdateComment() {
$msg = 'Hello Earth';
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')
+ ->disableOriginalConstructor()
+ ->getMock();
$user->expects($this->once())
->method('getUID')
@@ -173,7 +189,9 @@ class CommentsNodeTest extends \Test\TestCase {
public function testUpdateCommentLogException() {
$msg = null;
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')
+ ->disableOriginalConstructor()
+ ->getMock();
$user->expects($this->once())
->method('getUID')
@@ -210,7 +228,9 @@ class CommentsNodeTest extends \Test\TestCase {
* @expectedExceptionMessage Message exceeds allowed character limit of
*/
public function testUpdateCommentMessageTooLongException() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')
+ ->disableOriginalConstructor()
+ ->getMock();
$user->expects($this->once())
->method('getUID')
@@ -248,7 +268,9 @@ class CommentsNodeTest extends \Test\TestCase {
public function testUpdateForbiddenByUser() {
$msg = 'HaXX0r';
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')
+ ->disableOriginalConstructor()
+ ->getMock();
$user->expects($this->once())
->method('getUID')
@@ -281,7 +303,9 @@ class CommentsNodeTest extends \Test\TestCase {
public function testUpdateForbiddenByType() {
$msg = 'HaXX0r';
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')
+ ->disableOriginalConstructor()
+ ->getMock();
$user->expects($this->never())
->method('getUID');
@@ -454,7 +478,11 @@ class CommentsNodeTest extends \Test\TestCase {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($this->getMock('\OCP\IUser')));
+ ->will($this->returnValue(
+ $this->getMockBuilder('\OCP\IUser')
+ ->disableOriginalConstructor()
+ ->getMock()
+ ));
$properties = $this->node->getProperties(null);