Skip to content

Commit

Permalink
fixup! Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr committed Oct 12, 2020
1 parent f203553 commit 0ad609d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/Db/AssignedUsersMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

namespace OCA\Deck\Db;

use OCA\Deck\NotFoundException;
use OCA\Deck\Service\CirclesService;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\QBMapper;
Expand Down Expand Up @@ -97,7 +98,7 @@ public function findBoardId($cardId) {
public function insert(Entity $entity): Entity {
$origin = $this->getOrigin($entity);
if ($origin === null) {
throw new \Exception('No origin found for assignment');
throw new NotFoundException('No origin found for assignment');
}
/** @var AssignedUsers $assignment */
$assignment = parent::insert($entity);
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/database/AssignedUsersMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace OCA\Deck\Db;

use OCA\Deck\NotFoundException;
use OCA\Deck\Service\AssignmentService;
use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\StackService;
Expand Down Expand Up @@ -165,8 +166,8 @@ public function testInsertInvalidUser() {
$assignment->setCardId($this->cards[1]->getId());
$assignment->setParticipant('invalid-username');
$assignment->setType(AssignedUsers::TYPE_USER);
$actual = $this->assignedUsersMapper->insert($assignment);
$this->assertNull($actual);
$this->expectException(NotFoundException::class);
$this->assignedUsersMapper->insert($assignment);
}

/**
Expand Down

0 comments on commit 0ad609d

Please sign in to comment.