Fix tests after reordering has changed
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -402,6 +402,9 @@ class CardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$card = $this->cardMapper->find($id);
|
$card = $this->cardMapper->find($id);
|
||||||
|
if ($card->getArchived()) {
|
||||||
|
throw new StatusException('Operation not allowed. This card is archived.');
|
||||||
|
}
|
||||||
$card->setStackId($stackId);
|
$card->setStackId($stackId);
|
||||||
$this->cardMapper->update($card);
|
$this->cardMapper->update($card);
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,10 @@ class CardServiceTest extends TestCase {
|
|||||||
public function testReorder($cardId, $newPosition, $order) {
|
public function testReorder($cardId, $newPosition, $order) {
|
||||||
$cards = $this->getCards();
|
$cards = $this->getCards();
|
||||||
$cardsTmp = [];
|
$cardsTmp = [];
|
||||||
$this->cardMapper->expects($this->at(0))->method('findAll')->willReturn($cards);
|
$this->cardMapper->expects($this->once())->method('findAll')->willReturn($cards);
|
||||||
|
$card = new Card();
|
||||||
|
$card->setStackId(123);
|
||||||
|
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
|
||||||
$result = $this->cardService->reorder($cardId, 123, $newPosition);
|
$result = $this->cardService->reorder($cardId, 123, $newPosition);
|
||||||
foreach ($result as $card) {
|
foreach ($result as $card) {
|
||||||
$actual[$card->getOrder()] = $card->getId();
|
$actual[$card->getOrder()] = $card->getId();
|
||||||
@@ -254,7 +257,8 @@ class CardServiceTest extends TestCase {
|
|||||||
$card = new Card();
|
$card = new Card();
|
||||||
$card->setTitle('title');
|
$card->setTitle('title');
|
||||||
$card->setArchived(true);
|
$card->setArchived(true);
|
||||||
$this->cardMapper->expects($this->once())->method('findAll')->willReturn([$card]);
|
$card->setStackId(123);
|
||||||
|
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
|
||||||
$this->cardMapper->expects($this->never())->method('update')->willReturnCallback(function($c) { return $c; });
|
$this->cardMapper->expects($this->never())->method('update')->willReturnCallback(function($c) { return $c; });
|
||||||
$this->expectException(StatusException::class);
|
$this->expectException(StatusException::class);
|
||||||
$actual = $this->cardService->reorder(123, 234, 1);
|
$actual = $this->cardService->reorder(123, 234, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user