Skip to content

Commit 0ad609d

Browse files
committed
fixup! Fix tests
1 parent f203553 commit 0ad609d

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

lib/Db/AssignedUsersMapper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
namespace OCA\Deck\Db;
2727

28+
use OCA\Deck\NotFoundException;
2829
use OCA\Deck\Service\CirclesService;
2930
use OCP\AppFramework\Db\Entity;
3031
use OCP\AppFramework\Db\QBMapper;
@@ -97,7 +98,7 @@ public function findBoardId($cardId) {
9798
public function insert(Entity $entity): Entity {
9899
$origin = $this->getOrigin($entity);
99100
if ($origin === null) {
100-
throw new \Exception('No origin found for assignment');
101+
throw new NotFoundException('No origin found for assignment');
101102
}
102103
/** @var AssignedUsers $assignment */
103104
$assignment = parent::insert($entity);

tests/integration/database/AssignedUsersMapperTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
namespace OCA\Deck\Db;
2525

26+
use OCA\Deck\NotFoundException;
2627
use OCA\Deck\Service\AssignmentService;
2728
use OCA\Deck\Service\BoardService;
2829
use OCA\Deck\Service\StackService;
@@ -165,8 +166,8 @@ public function testInsertInvalidUser() {
165166
$assignment->setCardId($this->cards[1]->getId());
166167
$assignment->setParticipant('invalid-username');
167168
$assignment->setType(AssignedUsers::TYPE_USER);
168-
$actual = $this->assignedUsersMapper->insert($assignment);
169-
$this->assertNull($actual);
169+
$this->expectException(NotFoundException::class);
170+
$this->assignedUsersMapper->insert($assignment);
170171
}
171172

172173
/**

0 commit comments

Comments
 (0)