Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Apr 2, 2020
1 parent b974dd5 commit 8145547
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions apps/dav/tests/unit/Comments/CommentsNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function testDelete() {
$this->node->delete();
}


public function testDeleteForbidden() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);

Expand Down Expand Up @@ -149,7 +149,7 @@ public function testGetName() {
$this->assertSame($this->node->getName(), $id);
}


public function testSetName() {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);

Expand Down Expand Up @@ -194,7 +194,7 @@ public function testUpdateComment() {
$this->assertTrue($this->node->updateComment($msg));
}


public function testUpdateCommentLogException() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('buh!');
Expand Down Expand Up @@ -235,7 +235,7 @@ public function testUpdateCommentLogException() {
$this->node->updateComment($msg);
}


public function testUpdateCommentMessageTooLongException() {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('Message exceeds allowed character limit of');
Expand Down Expand Up @@ -274,7 +274,7 @@ public function testUpdateCommentMessageTooLongException() {
$this->node->updateComment('foo');
}


public function testUpdateForbiddenByUser() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);

Expand Down Expand Up @@ -309,7 +309,7 @@ public function testUpdateForbiddenByUser() {
$this->node->updateComment($msg);
}


public function testUpdateForbiddenByType() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);

Expand Down Expand Up @@ -339,7 +339,7 @@ public function testUpdateForbiddenByType() {
$this->node->updateComment($msg);
}


public function testUpdateForbiddenByNotLoggedIn() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);

Expand Down Expand Up @@ -402,6 +402,7 @@ public function testGetProperties() {
$ns . 'latestChildDateTime' => new \DateTime('2016-01-12 18:48:00'),
$ns . 'objectType' => 'files',
$ns . 'objectId' => '1848',
$ns . 'referenceId' => 'ref',
$ns . 'isUnread' => null,
];

Expand Down Expand Up @@ -468,6 +469,10 @@ public function testGetProperties() {
->method('getObjectId')
->willReturn($expected[$ns . 'objectId']);

$this->comment->expects($this->once())
->method('getReferenceId')
->willReturn($expected[$ns . 'referenceId']);

$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
Expand All @@ -483,7 +488,7 @@ public function testGetProperties() {
$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]);
}
Expand Down

0 comments on commit 8145547

Please sign in to comment.