]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix unit tests
authorJoas Schilling <coding@schilljs.com>
Thu, 2 Apr 2020 07:59:44 +0000 (09:59 +0200)
committerJoas Schilling <coding@schilljs.com>
Thu, 2 Apr 2020 07:59:44 +0000 (09:59 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/dav/tests/unit/Comments/CommentsNodeTest.php

index 9d0e56041d03ad7030a19923b6f603308932a0c1..4f6d96aa7f274aa24e051251a89b36f2f0742167 100644 (file)
@@ -107,7 +107,7 @@ class CommentsNodeTest extends \Test\TestCase {
                $this->node->delete();
        }
 
-       
+
        public function testDeleteForbidden() {
                $this->expectException(\Sabre\DAV\Exception\Forbidden::class);
 
@@ -149,7 +149,7 @@ class CommentsNodeTest extends \Test\TestCase {
                $this->assertSame($this->node->getName(), $id);
        }
 
-       
+
        public function testSetName() {
                $this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
 
@@ -194,7 +194,7 @@ class CommentsNodeTest extends \Test\TestCase {
                $this->assertTrue($this->node->updateComment($msg));
        }
 
-       
+
        public function testUpdateCommentLogException() {
                $this->expectException(\Exception::class);
                $this->expectExceptionMessage('buh!');
@@ -235,7 +235,7 @@ class CommentsNodeTest extends \Test\TestCase {
                $this->node->updateComment($msg);
        }
 
-       
+
        public function testUpdateCommentMessageTooLongException() {
                $this->expectException(\Sabre\DAV\Exception\BadRequest::class);
                $this->expectExceptionMessage('Message exceeds allowed character limit of');
@@ -274,7 +274,7 @@ class CommentsNodeTest extends \Test\TestCase {
                $this->node->updateComment('foo');
        }
 
-       
+
        public function testUpdateForbiddenByUser() {
                $this->expectException(\Sabre\DAV\Exception\Forbidden::class);
 
@@ -309,7 +309,7 @@ class CommentsNodeTest extends \Test\TestCase {
                $this->node->updateComment($msg);
        }
 
-       
+
        public function testUpdateForbiddenByType() {
                $this->expectException(\Sabre\DAV\Exception\Forbidden::class);
 
@@ -339,7 +339,7 @@ class CommentsNodeTest extends \Test\TestCase {
                $this->node->updateComment($msg);
        }
 
-       
+
        public function testUpdateForbiddenByNotLoggedIn() {
                $this->expectException(\Sabre\DAV\Exception\Forbidden::class);
 
@@ -402,6 +402,7 @@ class CommentsNodeTest extends \Test\TestCase {
                        $ns . 'latestChildDateTime' => new \DateTime('2016-01-12 18:48:00'),
                        $ns . 'objectType' => 'files',
                        $ns . 'objectId' => '1848',
+                       $ns . 'referenceId' => 'ref',
                        $ns . 'isUnread' => null,
                ];
 
@@ -468,6 +469,10 @@ class CommentsNodeTest extends \Test\TestCase {
                        ->method('getObjectId')
                        ->willReturn($expected[$ns . 'objectId']);
 
+               $this->comment->expects($this->once())
+                       ->method('getReferenceId')
+                       ->willReturn($expected[$ns . 'referenceId']);
+
                $user = $this->getMockBuilder(IUser::class)
                        ->disableOriginalConstructor()
                        ->getMock();
@@ -483,7 +488,7 @@ class CommentsNodeTest extends \Test\TestCase {
                $properties = $this->node->getProperties(null);
 
                foreach($properties as $name => $value) {
-                       $this->assertTrue(array_key_exists($name, $expected));
+                       $this->assertArrayHasKey($name, $expected);
                        $this->assertSame($expected[$name], $value);
                        unset($expected[$name]);
                }