Resolved unit tests errors, down from 36 to 9.

Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
This commit is contained in:
Ryan Fletcher
2018-07-14 15:11:21 -04:00
committed by Julius Härtl
parent 881b05aeb1
commit e0049cf07b
2 changed files with 14 additions and 11 deletions

View File

@@ -151,7 +151,7 @@ class CardServiceTest extends TestCase {
$card->setArchived(true);
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
$this->cardMapper->expects($this->never())->method('update');
$this->setExpectedException(StatusException::class);
$this->expectException(StatusException::class);
$this->cardService->update(123, 'newtitle', 234, 'text', 999, 'foo', 'admin', '2017-01-01 00:00:00', null);
}
@@ -171,7 +171,7 @@ class CardServiceTest extends TestCase {
$card->setArchived(true);
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
$this->cardMapper->expects($this->never())->method('update');
$this->setExpectedException(StatusException::class);
$this->expectException(StatusException::class);
$this->cardService->rename(123, 'newtitle');
}
@@ -211,7 +211,7 @@ class CardServiceTest extends TestCase {
$card->setArchived(true);
$this->cardMapper->expects($this->once())->method('findAll')->willReturn([$card]);
$this->cardMapper->expects($this->never())->method('update')->willReturnCallback(function($c) { return $c; });
$this->setExpectedException(StatusException::class);
$this->expectException(StatusException::class);
$actual = $this->cardService->reorder(123, 234, 1);
}
public function testArchive() {
@@ -247,7 +247,7 @@ class CardServiceTest extends TestCase {
$card->setArchived(true);
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
$this->cardMapper->expects($this->never())->method('assignLabel');
$this->setExpectedException(StatusException::class);
$this->expectException(StatusException::class);
$this->cardService->assignLabel(123, 999);
}
@@ -264,7 +264,7 @@ class CardServiceTest extends TestCase {
$card->setArchived(true);
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
$this->cardMapper->expects($this->never())->method('removeLabel');
$this->setExpectedException(StatusException::class);
$this->expectException(StatusException::class);
$this->cardService->removeLabel(123, 999);
}
@@ -320,7 +320,10 @@ class CardServiceTest extends TestCase {
}
/**
* @expectedException \OCA\Deck\NotFoundException
* @expectException \OCA\Deck\NotFoundException
*
*
*
*/
public function testUnassignUserNotExisting() {
$assignment = new AssignedUsers();

View File

@@ -231,7 +231,7 @@ class PermissionServiceTest extends \Test\TestCase {
$actual = $this->service->checkPermission($mapper, 1234, $permission);
$this->assertTrue($actual);
} else {
$this->setExpectedException(NoPermissionException::class);
$this->expectException(NoPermissionException::class);
$this->service->checkPermission($mapper, 1234, $permission);
}
@@ -255,7 +255,7 @@ class PermissionServiceTest extends \Test\TestCase {
$actual = $this->service->checkPermission($mapper, 1234, $permission);
$this->assertTrue($actual);
} else {
$this->setExpectedException(NoPermissionException::class);
$this->expectException(NoPermissionException::class);
$this->service->checkPermission($mapper, 1234, $permission);
}
@@ -264,7 +264,7 @@ class PermissionServiceTest extends \Test\TestCase {
public function testCheckPermissionNotFound() {
$mapper = $this->getMockBuilder(IPermissionMapper::class)->getMock();
$mapper->expects($this->once())->method('findBoardId')->willThrowException(new NoPermissionException(null));
$this->setExpectedException(NoPermissionException::class);
$this->expectException(NoPermissionException::class);
$this->service->checkPermission($mapper, 1234, Acl::PERMISSION_READ);
}