Merge remote-tracking branch 'origin/vue' into master-merge-vue

This commit is contained in:
Julius Härtl
2020-01-25 10:42:05 +01:00
137 changed files with 27543 additions and 17157 deletions

View File

@@ -221,24 +221,27 @@ class CardServiceTest extends TestCase {
$this->cardService->rename(123, 'newtitle');
}
public function dataReorder() {
return [
[0, 0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]],
[0, 9, [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]],
[1, 3, [0, 2, 3, 1, 4, 5, 6, 7, 8, 9]]
];
}
/** @dataProvider dataReorder */
public function testReorder($cardId, $newPosition, $order) {
$cards = $this->getCards();
$cardsTmp = [];
$this->cardMapper->expects($this->at(0))->method('findAll')->willReturn($cards);
$result = $this->cardService->reorder($cardId, 123, $newPosition);
foreach ($result as $card) {
$actual[$card->getOrder()] = $card->getId();
}
$this->assertEquals($order, $actual);
}
public function dataReorder() {
return [
[0, 0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]],
[0, 9, [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]],
[1, 3, [0, 2, 3, 1, 4, 5, 6, 7, 8, 9]]
];
}
/** @dataProvider dataReorder */
public function testReorder($cardId, $newPosition, $order) {
$cards = $this->getCards();
$cardsTmp = [];
$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);
foreach ($result as $card) {
$actual[$card->getOrder()] = $card->getId();
}
$this->assertEquals($order, $actual);
}
private function getCards() {
$cards = [];
@@ -251,34 +254,35 @@ class CardServiceTest extends TestCase {
return $cards;
}
public function testReorderArchived() {
$card = new Card();
$card->setTitle('title');
$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->expectException(StatusException::class);
$actual = $this->cardService->reorder(123, 234, 1);
}
public function testArchive() {
$card = new Card();
$this->assertFalse($card->getArchived());
public function testReorderArchived() {
$card = new Card();
$card->setTitle('title');
$card->setArchived(true);
$card->setStackId(123);
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
$this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function($c) {
return $c;
});
$this->assertTrue($this->cardService->archive(123)->getArchived());
}
public function testUnarchive() {
$card = new Card();
$card->setArchived(true);
$this->assertTrue($card->getArchived());
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
$this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function($c) {
return $c;
});
$this->assertFalse($this->cardService->unarchive(123)->getArchived());
}
$this->cardMapper->expects($this->never())->method('update')->willReturnCallback(function($c) { return $c; });
$this->expectException(StatusException::class);
$actual = $this->cardService->reorder(123, 234, 1);
}
public function testArchive() {
$card = new Card();
$this->assertFalse($card->getArchived());
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
$this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function($c) {
return $c;
});
$this->assertTrue($this->cardService->archive(123)->getArchived());
}
public function testUnarchive() {
$card = new Card();
$card->setArchived(true);
$this->assertTrue($card->getArchived());
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
$this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function($c) {
return $c;
});
$this->assertFalse($this->cardService->unarchive(123)->getArchived());
}
public function testAssignLabel() {
$card = new Card();

View File

@@ -103,7 +103,7 @@ class DefaultBoardServiceTest extends TestCase {
$board = new Board();
$board->setTitle('Personal');
$board->setOwner($this->userId);
$board->setColor('000000');
$board->setColor('317CCC');
$userBoards = [$board];
@@ -121,7 +121,7 @@ class DefaultBoardServiceTest extends TestCase {
public function testCreateDefaultBoard() {
$title = 'Personal';
$color = '000000';
$color = '317CCC';
$boardId = 5;
$board = new Board();

View File

@@ -59,7 +59,7 @@ class PageControllerTest extends \Test\TestCase {
$board = new Board();
$board->setTitle('Personal');
$board->setOwner($this->userId);
$board->setColor('000000');
$board->setColor('317CCC');
$this->defaultBoardService->expects($this->once())
->method('checkFirstRun')
@@ -82,7 +82,7 @@ class PageControllerTest extends \Test\TestCase {
$board = new Board();
$board->setTitle('Personal');
$board->setOwner($this->userId);
$board->setColor('000000');
$board->setColor('317CCC');
$this->defaultBoardService->expects($this->once())
->method('checkFirstRun')