Skip to content
Snippets Groups Projects
Unverified Commit 81455479 authored by Joas Schilling's avatar Joas Schilling
Browse files

Fix unit tests

parent b974dd5b
No related branches found
No related tags found
No related merge requests found
...@@ -107,7 +107,7 @@ class CommentsNodeTest extends \Test\TestCase { ...@@ -107,7 +107,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->node->delete(); $this->node->delete();
} }
public function testDeleteForbidden() { public function testDeleteForbidden() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->expectException(\Sabre\DAV\Exception\Forbidden::class);
...@@ -149,7 +149,7 @@ class CommentsNodeTest extends \Test\TestCase { ...@@ -149,7 +149,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->assertSame($this->node->getName(), $id); $this->assertSame($this->node->getName(), $id);
} }
public function testSetName() { public function testSetName() {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class); $this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
...@@ -194,7 +194,7 @@ class CommentsNodeTest extends \Test\TestCase { ...@@ -194,7 +194,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->assertTrue($this->node->updateComment($msg)); $this->assertTrue($this->node->updateComment($msg));
} }
public function testUpdateCommentLogException() { public function testUpdateCommentLogException() {
$this->expectException(\Exception::class); $this->expectException(\Exception::class);
$this->expectExceptionMessage('buh!'); $this->expectExceptionMessage('buh!');
...@@ -235,7 +235,7 @@ class CommentsNodeTest extends \Test\TestCase { ...@@ -235,7 +235,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->node->updateComment($msg); $this->node->updateComment($msg);
} }
public function testUpdateCommentMessageTooLongException() { public function testUpdateCommentMessageTooLongException() {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class); $this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('Message exceeds allowed character limit of'); $this->expectExceptionMessage('Message exceeds allowed character limit of');
...@@ -274,7 +274,7 @@ class CommentsNodeTest extends \Test\TestCase { ...@@ -274,7 +274,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->node->updateComment('foo'); $this->node->updateComment('foo');
} }
public function testUpdateForbiddenByUser() { public function testUpdateForbiddenByUser() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->expectException(\Sabre\DAV\Exception\Forbidden::class);
...@@ -309,7 +309,7 @@ class CommentsNodeTest extends \Test\TestCase { ...@@ -309,7 +309,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->node->updateComment($msg); $this->node->updateComment($msg);
} }
public function testUpdateForbiddenByType() { public function testUpdateForbiddenByType() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->expectException(\Sabre\DAV\Exception\Forbidden::class);
...@@ -339,7 +339,7 @@ class CommentsNodeTest extends \Test\TestCase { ...@@ -339,7 +339,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->node->updateComment($msg); $this->node->updateComment($msg);
} }
public function testUpdateForbiddenByNotLoggedIn() { public function testUpdateForbiddenByNotLoggedIn() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->expectException(\Sabre\DAV\Exception\Forbidden::class);
...@@ -402,6 +402,7 @@ class CommentsNodeTest extends \Test\TestCase { ...@@ -402,6 +402,7 @@ class CommentsNodeTest extends \Test\TestCase {
$ns . 'latestChildDateTime' => new \DateTime('2016-01-12 18:48:00'), $ns . 'latestChildDateTime' => new \DateTime('2016-01-12 18:48:00'),
$ns . 'objectType' => 'files', $ns . 'objectType' => 'files',
$ns . 'objectId' => '1848', $ns . 'objectId' => '1848',
$ns . 'referenceId' => 'ref',
$ns . 'isUnread' => null, $ns . 'isUnread' => null,
]; ];
...@@ -468,6 +469,10 @@ class CommentsNodeTest extends \Test\TestCase { ...@@ -468,6 +469,10 @@ class CommentsNodeTest extends \Test\TestCase {
->method('getObjectId') ->method('getObjectId')
->willReturn($expected[$ns . 'objectId']); ->willReturn($expected[$ns . 'objectId']);
$this->comment->expects($this->once())
->method('getReferenceId')
->willReturn($expected[$ns . 'referenceId']);
$user = $this->getMockBuilder(IUser::class) $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
...@@ -483,7 +488,7 @@ class CommentsNodeTest extends \Test\TestCase { ...@@ -483,7 +488,7 @@ class CommentsNodeTest extends \Test\TestCase {
$properties = $this->node->getProperties(null); $properties = $this->node->getProperties(null);
foreach($properties as $name => $value) { foreach($properties as $name => $value) {
$this->assertTrue(array_key_exists($name, $expected)); $this->assertArrayHasKey($name, $expected);
$this->assertSame($expected[$name], $value); $this->assertSame($expected[$name], $value);
unset($expected[$name]); unset($expected[$name]);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment