tests: Fix unit test mocking around label checks
Signed-off-by: Julius Knorr <jus@bitgrid.net>
This commit is contained in:
@@ -258,6 +258,17 @@ class CardServiceTest extends TestCase {
|
|||||||
->method('find')
|
->method('find')
|
||||||
->willReturn($card, $clonedCard);
|
->willReturn($card, $clonedCard);
|
||||||
|
|
||||||
|
$this->cardMapper->expects($this->any())
|
||||||
|
->method('findBoardId')
|
||||||
|
->willReturn(1234);
|
||||||
|
|
||||||
|
$this->labelMapper->expects($this->any())
|
||||||
|
->method('find')
|
||||||
|
->willReturn(Label::fromRow([
|
||||||
|
'id' => 1,
|
||||||
|
'boardId' => 1234,
|
||||||
|
]));
|
||||||
|
|
||||||
// check if users are assigned
|
// check if users are assigned
|
||||||
$this->assignmentService->expects($this->once())
|
$this->assignmentService->expects($this->once())
|
||||||
->method('assignUser')
|
->method('assignUser')
|
||||||
@@ -433,8 +444,17 @@ class CardServiceTest extends TestCase {
|
|||||||
public function testAssignLabel() {
|
public function testAssignLabel() {
|
||||||
$card = new Card();
|
$card = new Card();
|
||||||
$card->setArchived(false);
|
$card->setArchived(false);
|
||||||
|
$card->setId(123);
|
||||||
|
$label = new Label();
|
||||||
|
$label->setBoardId(1);
|
||||||
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
|
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
|
||||||
$this->cardMapper->expects($this->once())->method('assignLabel');
|
$this->cardMapper->expects($this->once())->method('assignLabel');
|
||||||
|
$this->cardMapper->expects($this->once())
|
||||||
|
->method('findBoardId')
|
||||||
|
->willReturn(1);
|
||||||
|
$this->labelMapper->expects($this->once())
|
||||||
|
->method('find')
|
||||||
|
->willReturn($label);
|
||||||
$this->cardService->assignLabel(123, 999);
|
$this->cardService->assignLabel(123, 999);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,8 +470,17 @@ class CardServiceTest extends TestCase {
|
|||||||
public function testRemoveLabel() {
|
public function testRemoveLabel() {
|
||||||
$card = new Card();
|
$card = new Card();
|
||||||
$card->setArchived(false);
|
$card->setArchived(false);
|
||||||
|
$card->setId(123);
|
||||||
|
$label = new Label();
|
||||||
|
$label->setBoardId(1);
|
||||||
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
|
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
|
||||||
$this->cardMapper->expects($this->once())->method('removeLabel');
|
$this->cardMapper->expects($this->once())->method('removeLabel');
|
||||||
|
$this->cardMapper->expects($this->once())
|
||||||
|
->method('findBoardId')
|
||||||
|
->willReturn(1);
|
||||||
|
$this->labelMapper->expects($this->once())
|
||||||
|
->method('find')
|
||||||
|
->willReturn($label);
|
||||||
$this->cardService->removeLabel(123, 999);
|
$this->cardService->removeLabel(123, 999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user