diff --git a/lib/Db/Card.php b/lib/Db/Card.php index 9b0453740..ff2010933 100644 --- a/lib/Db/Card.php +++ b/lib/Db/Card.php @@ -38,7 +38,7 @@ class Card extends Entity implements JsonSerializable { protected $labels; protected $owner; protected $order; - protected $archived; + protected $archived = false; public function __construct() { $this->addType('id','integer'); diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php index 9ac6ca3dc..8b59b65fa 100644 --- a/lib/Service/BoardService.php +++ b/lib/Service/BoardService.php @@ -45,7 +45,6 @@ class BoardService { public function __construct( BoardMapper $boardMapper, - ILogger $logger, IL10N $l10n, LabelMapper $labelMapper, AclMapper $aclMapper, diff --git a/lib/Service/CardService.php b/lib/Service/CardService.php index 39be7497e..0878302fe 100644 --- a/lib/Service/CardService.php +++ b/lib/Service/CardService.php @@ -92,6 +92,7 @@ class CardService { public function reorder($id, $stackId, $order) { $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); $cards = $this->cardMapper->findAll($stackId); + $result = []; $i = 0; foreach ($cards as $card) { if($card->getArchived()) { @@ -109,10 +110,10 @@ class CardService { $card->setOrder($i++); } $this->cardMapper->update($card); + $result[$card->getOrder()] = $card; } - // FIXME: return reordered cards without an additional db query - $cards = $this->cardMapper->findAll($stackId); - return $cards; + + return $result; } public function archive($id) { diff --git a/lib/Service/LabelService.php b/lib/Service/LabelService.php index a25c023d4..9e88f93be 100644 --- a/lib/Service/LabelService.php +++ b/lib/Service/LabelService.php @@ -42,8 +42,7 @@ class LabelService { public function find($labelId) { $this->permissionService->checkPermission($this->labelMapper, $labelId, Acl::PERMISSION_READ); - $label = $this->labelMapper->find($labelId); - return $label; + return $this->labelMapper->find($labelId); } public function create($title, $color, $boardId) { diff --git a/lib/Service/StackService.php b/lib/Service/StackService.php index 63ec55370..6e2cffbfc 100644 --- a/lib/Service/StackService.php +++ b/lib/Service/StackService.php @@ -40,17 +40,13 @@ class StackService { private $stackMapper; private $cardMapper; - private $logger; private $labelMapper; private $permissionService; - public function __construct(StackMapper $stackMapper, CardMapper $cardMapper, LabelMapper $labelMapper, ILogger $logger, - IL10N $l10n, - ITimeFactory $timeFactory, PermissionService $permissionService) { + public function __construct(StackMapper $stackMapper, CardMapper $cardMapper, LabelMapper $labelMapper, PermissionService $permissionService) { $this->stackMapper = $stackMapper; $this->cardMapper = $cardMapper; $this->labelMapper = $labelMapper; - $this->logger = $logger; $this->permissionService = $permissionService; } diff --git a/tests/unit/Db/AclMapperTest.php b/tests/unit/Db/AclMapperTest.php index c4ebf8954..84d66c319 100644 --- a/tests/unit/Db/AclMapperTest.php +++ b/tests/unit/Db/AclMapperTest.php @@ -25,6 +25,11 @@ namespace OCA\Deck\Db; use Test\AppFramework\Db\MapperTestUtility; +/** + * Class AclMapperTest + * @package OCA\Deck\Db + * @group DB + */ class AclMapperTest extends MapperTestUtility { private $mapper; @@ -32,7 +37,13 @@ class AclMapperTest extends MapperTestUtility { public function setup(){ parent::setUp(); + + $this->dbConnection = \OC::$server->getDatabaseConnection(); $this->mapper = new AclMapper($this->db); + $this->mapperDatabase = new AclMapper($this->dbConnection); + + //$acl = $this->getAcl('user','user1'); + //$this->mapperDatabase->insert($acl); } /** @return Acl */ public function getAcl($type='user', $participant='admin', $write=false, $invite=false, $manage=false, $boardId=123) { diff --git a/tests/unit/Db/AclTest.php b/tests/unit/Db/AclTest.php index 2df1333e3..c83cd98a5 100644 --- a/tests/unit/Db/AclTest.php +++ b/tests/unit/Db/AclTest.php @@ -99,6 +99,7 @@ class AclTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_EDIT)); $this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_MANAGE)); $this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_SHARE)); + $this->assertEquals(false, $acl->getPermission(5)); } } \ No newline at end of file diff --git a/tests/unit/Service/BoardServiceTest.php b/tests/unit/Service/BoardServiceTest.php index 36b197cc3..ff188e6c7 100644 --- a/tests/unit/Service/BoardServiceTest.php +++ b/tests/unit/Service/BoardServiceTest.php @@ -41,14 +41,12 @@ class BoardServiceTest extends \PHPUnit_Framework_TestCase { private $aclMapper; private $boardMapper; private $groupManager; + private $permissionService; private $userId = 'admin'; public function setUp() { - $this->logger = $this->request = $this->getMockBuilder(ILogger::class) - ->disableOriginalConstructor() - ->getMock(); - $this->l10n = $this->request = $this->getMockBuilder(L10N::class) + $this->l10n = $this->getMockBuilder(L10N::class) ->disableOriginalConstructor() ->getMock(); $this->aclMapper = $this->getMockBuilder(AclMapper::class) @@ -62,7 +60,6 @@ class BoardServiceTest extends \PHPUnit_Framework_TestCase { $this->service = new BoardService( $this->boardMapper, - $this->logger, $this->l10n, $this->labelMapper, $this->aclMapper, diff --git a/tests/unit/Service/CardServiceTest.php b/tests/unit/Service/CardServiceTest.php new file mode 100644 index 000000000..f0f49d8c1 --- /dev/null +++ b/tests/unit/Service/CardServiceTest.php @@ -0,0 +1,229 @@ + + * + * @author Julius Härtl + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Deck\Service; + + +use OCA\Deck\Db\Card; +use OCA\Deck\Db\CardMapper; +use OCA\Deck\Db\StackMapper; +use OCA\Deck\CardArchivedException; + +class CardServiceTest extends \PHPUnit_Framework_TestCase { + + /** @var CardService|\PHPUnit_Framework_MockObject_MockObject */ + private $cardService; + /** @var CardMapper|\PHPUnit_Framework_MockObject_MockObject */ + private $cardMapper; + /** @var StackMapper|\PHPUnit_Framework_MockObject_MockObject */ + private $stackMapper; + /** @var PermissionService|\PHPUnit_Framework_MockObject_MockObject */ + private $permissionService; + + + public function setUp() { + $this->cardMapper = $this->getMockBuilder(CardMapper::class) + ->disableOriginalConstructor()->getMock(); + $this->stackMapper = $this->getMockBuilder(StackMapper::class) + ->disableOriginalConstructor()->getMock(); + $this->permissionService = $this->getMockBuilder(PermissionService::class) + ->disableOriginalConstructor()->getMock(); + $this->cardService = new CardService($this->cardMapper, $this->stackMapper, $this->permissionService); + } + + public function testFind() { + $this->cardMapper->expects($this->once()) + ->method('find') + ->with(123) + ->willReturn(1); + $this->assertEquals(1, $this->cardService->find(123)); + } + + public function testCreate() { + $card = new Card(); + $card->setTitle('Card title'); + $card->setOwner('admin'); + $card->setStackId(123); + $card->setOrder(999); + $card->setType('text'); + $this->cardMapper->expects($this->once()) + ->method('insert') + ->willReturn($card); + $b = $this->cardService->create('Card title', 123, 'text', 999, 'admin'); + + $this->assertEquals($b->getTitle(), 'Card title'); + $this->assertEquals($b->getOwner(), 'admin'); + $this->assertEquals($b->getType(), 'text'); + $this->assertEquals($b->getOrder(), 999); + $this->assertEquals($b->getStackId(), 123); + } + + public function testDelete() { + $this->cardMapper->expects($this->once()) + ->method('find') + ->willReturn(new Card()); + $this->cardMapper->expects($this->once()) + ->method('delete') + ->willReturn(1); + $this->assertEquals(1, $this->cardService->delete(123)); + } + + public function testUpdate() { + $card = new Card(); + $card->setTitle('title'); + $card->setArchived(false); + $this->cardMapper->expects($this->once())->method('find')->willReturn($card); + $this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function($c) { return $c; }); + $actual = $this->cardService->update(123, 'newtitle', 234, 'text', 999, 'foo', 'admin'); + $this->assertEquals('newtitle', $actual->getTitle()); + $this->assertEquals(234, $actual->getStackId()); + $this->assertEquals('text', $actual->getType()); + $this->assertEquals(999, $actual->getOrder()); + $this->assertEquals('foo', $actual->getDescription()); + } + + public function testUpdateArchived() { + $card = new Card(); + $card->setTitle('title'); + $card->setArchived(true); + $this->cardMapper->expects($this->once())->method('find')->willReturn($card); + $this->cardMapper->expects($this->never())->method('update'); + $this->setExpectedException(CardArchivedException::class); + $this->cardService->update(123, 'newtitle', 234, 'text', 999, 'foo', 'admin'); + } + + public function testRename() { + $card = new Card(); + $card->setTitle('title'); + $card->setArchived(false); + $this->cardMapper->expects($this->once())->method('find')->willReturn($card); + $this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function($c) { return $c; }); + $actual = $this->cardService->rename(123, 'newtitle'); + $this->assertEquals('newtitle', $actual->getTitle()); + } + + public function testRenameArchived() { + $card = new Card(); + $card->setTitle('title'); + $card->setArchived(true); + $this->cardMapper->expects($this->once())->method('find')->willReturn($card); + $this->cardMapper->expects($this->never())->method('update'); + $this->setExpectedException(CardArchivedException::class); + $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); + } + + private function getCards() { + $cards = []; + for($i=0; $i<10; $i++) { + $cards[$i] = new Card(); + $cards[$i]->setTitle($i); + $cards[$i]->setOrder($i); + $cards[$i]->setId($i); + } + 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->setExpectedException(CardArchivedException::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(); + $card->setArchived(false); + $this->cardMapper->expects($this->once())->method('find')->willReturn($card); + $this->cardMapper->expects($this->once())->method('assignLabel'); + $this->cardService->assignLabel(123, 999); + } + + public function testAssignLabelArchived() { + $card = new Card(); + $card->setArchived(true); + $this->cardMapper->expects($this->once())->method('find')->willReturn($card); + $this->cardMapper->expects($this->never())->method('assignLabel'); + $this->setExpectedException(CardArchivedException::class); + $this->cardService->assignLabel(123, 999); + } + + public function testRemoveLabel() { + $card = new Card(); + $card->setArchived(false); + $this->cardMapper->expects($this->once())->method('find')->willReturn($card); + $this->cardMapper->expects($this->once())->method('removeLabel'); + $this->cardService->removeLabel(123, 999); + } + + public function testRemoveLabelArchived() { + $card = new Card(); + $card->setArchived(true); + $this->cardMapper->expects($this->once())->method('find')->willReturn($card); + $this->cardMapper->expects($this->never())->method('removeLabel'); + $this->setExpectedException(CardArchivedException::class); + $this->cardService->removeLabel(123, 999); + } + + +} \ No newline at end of file diff --git a/tests/unit/Service/LabelServiceTest.php b/tests/unit/Service/LabelServiceTest.php new file mode 100644 index 000000000..561b07859 --- /dev/null +++ b/tests/unit/Service/LabelServiceTest.php @@ -0,0 +1,101 @@ + + * + * @author Julius Härtl + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Deck\Service; + + +use OCA\Deck\Db\Label; +use OCA\Deck\Db\LabelMapper; + +class LabelServiceTest extends \PHPUnit_Framework_TestCase { + + /** @var LabelMapper|\PHPUnit_Framework_MockObject_MockObject */ + private $labelMapper; + /** @var PermissionService|\PHPUnit_Framework_MockObject_MockObject */ + private $permissionService; + /** @var LabelService */ + private $labelService; + + public function setUp() { + $this->labelMapper = $this->getMockBuilder(LabelMapper::class) + ->disableOriginalConstructor()->getMock(); + $this->permissionService = $this->getMockBuilder(PermissionService::class) + ->disableOriginalConstructor()->getMock(); + $this->labelService = new LabelService( + $this->labelMapper, + $this->permissionService + ); + } + + public function testFind() { + $this->labelMapper->expects($this->once())->method('find')->willReturn(true); + $this->assertTrue($this->labelService->find(123)); + } + + public function testCreate() { + $label = new Label(); + $label->setTitle('Label title'); + $label->setBoardId(123); + $label->setColor('00ff00'); + $this->labelMapper->expects($this->once()) + ->method('insert') + ->willReturn($label); + $b = $this->labelService->create('Label title', '00ff00', 123); + + $this->assertEquals($b->getTitle(), 'Label title'); + $this->assertEquals($b->getBoardId(), 123); + $this->assertEquals($b->getColor(), '00ff00'); + } + + + public function testUpdate() { + $label = new Label(); + $label->setTitle('Title'); + $label->setBoardId(123); + $label->setColor('00ff00'); + $this->labelMapper->expects($this->once()) + ->method('find') + ->with(1) + ->willReturn($label); + $this->labelMapper->expects($this->once()) + ->method('update') + ->with($label) + ->willReturn($label); + $b = $this->labelService->update(1, 'NewTitle', 'ffffff'); + + $this->assertEquals($b->getTitle(), 'NewTitle'); + $this->assertEquals($b->getBoardId(), 123); + $this->assertEquals($b->getColor(), 'ffffff'); + } + + public function testDelete() { + $this->labelMapper->expects($this->once()) + ->method('find') + ->willReturn(new Label()); + $this->labelMapper->expects($this->once()) + ->method('delete') + ->willReturn(1); + $this->assertEquals(1, $this->labelService->delete(123)); + } + +} \ No newline at end of file diff --git a/tests/unit/Service/PermissionServiceTest.php b/tests/unit/Service/PermissionServiceTest.php index e105edf34..f42cfcc6f 100644 --- a/tests/unit/Service/PermissionServiceTest.php +++ b/tests/unit/Service/PermissionServiceTest.php @@ -29,6 +29,7 @@ use OCA\Deck\Db\Board; use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\IPermissionMapper; use OCA\Deck\NoPermissionException; +use OCP\AppFramework\Db\DoesNotExistException; use OCP\IGroupManager; use OCP\ILogger; @@ -39,7 +40,8 @@ class PermissionServiceTest extends \PHPUnit_Framework_TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject|ILogger */ private $logger; private $aclMapper; - private $boardMapper; + /** @var \PHPUnit_Framework_MockObject_MockObject|BoardMapper */ + private $boardMapper; private $groupManager; private $userId = 'admin'; @@ -230,7 +232,11 @@ class PermissionServiceTest extends \PHPUnit_Framework_TestCase { $board = new Board(); $board->setId($boardId); $board->setOwner($owner); - $this->boardMapper->expects($this->any())->method('find')->willReturn($board); + if($boardId === null) { + $this->boardMapper->expects($this->any())->method('find')->willThrowException(new DoesNotExistException('not found')); + } else { + $this->boardMapper->expects($this->any())->method('find')->willReturn($board); + } $acls = $this->getAcls($boardId); $this->aclMapper->expects($this->any())->method('findAll')->willReturn($acls); diff --git a/tests/unit/Service/StackServiceTest.php b/tests/unit/Service/StackServiceTest.php new file mode 100644 index 000000000..86c84a40d --- /dev/null +++ b/tests/unit/Service/StackServiceTest.php @@ -0,0 +1,164 @@ + + * + * @author Julius Härtl + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Deck\Service; + + + +use OCA\Deck\Db\Card; +use OCA\Deck\Db\CardMapper; +use OCA\Deck\Db\Label; +use OCA\Deck\Db\LabelMapper; +use OCA\Deck\Db\Stack; +use OCA\Deck\Db\StackMapper; + +class StackServiceTest extends \PHPUnit_Framework_TestCase { + + /** @var StackService */ + private $stackService; + /** @var \PHPUnit_Framework_MockObject_MockObject|StackMapper */ + private $stackMapper; + /** @var \PHPUnit_Framework_MockObject_MockObject|CardMapper */ + private $cardMapper; + /** @var \PHPUnit_Framework_MockObject_MockObject|LabelMapper */ + private $labelMapper; + /** @var \PHPUnit_Framework_MockObject_MockObject|PermissionService */ + private $permissionService; + + public function setUp() { + $this->stackMapper = $this->getMockBuilder(StackMapper::class) + ->disableOriginalConstructor()->getMock(); + $this->cardMapper = $this->getMockBuilder(CardMapper::class) + ->disableOriginalConstructor()->getMock(); + $this->labelMapper = $this->getMockBuilder(LabelMapper::class) + ->disableOriginalConstructor()->getMock(); + $this->permissionService = $this->getMockBuilder(PermissionService::class) + ->disableOriginalConstructor()->getMock(); + + $this->stackService = new StackService( + $this->stackMapper, + $this->cardMapper, + $this->labelMapper, + $this->permissionService + ); + } + + public function testFindAll() { + // FIXME: FIX ME !!! + $this->permissionService->expects($this->once())->method('checkPermission'); + $this->stackMapper->expects($this->once())->method('findAll')->willReturn($this->getStacks()); + $this->labelMapper->expects($this->once())->method('getAssignedLabelsForBoard')->willReturn($this->getLabels()); + $this->cardMapper->expects($this->any())->method('findAll')->willReturn($this->getCards(222)); + + $actual = $this->stackService->findAll(123); + for($stackId=0; $stackId<3; $stackId++) { + for ($cardId=0;$cardId<10;$cardId++) { + $this->assertEquals($actual[0]->getCards()[$cardId]->getId(), $cardId); + $this->assertEquals($actual[0]->getCards()[$cardId]->getStackId(), 222); + $this->assertEquals($actual[0]->getCards()[$cardId]->getLabels(), $this->getLabels()[$cardId]); + } + } + } + + public function testFindAllArchived() { + $this->permissionService->expects($this->once())->method('checkPermission'); + $this->stackMapper->expects($this->once())->method('findAll')->willReturn($this->getStacks()); + $this->labelMapper->expects($this->once())->method('getAssignedLabelsForBoard')->willReturn($this->getLabels()); + $this->cardMapper->expects($this->any())->method('findAllArchived')->willReturn($this->getCards(222)); + + $actual = $this->stackService->findAllArchived(123); + for($stackId=0; $stackId<3; $stackId++) { + for ($cardId=0;$cardId<10;$cardId++) { + $this->assertEquals($actual[0]->getCards()[$cardId]->getId(), $cardId); + $this->assertEquals($actual[0]->getCards()[$cardId]->getStackId(), 222); + $this->assertEquals($actual[0]->getCards()[$cardId]->getLabels(), $this->getLabels()[$cardId]); + } + } +} + + private function getLabels() { + for ($i=0;$i<10;$i++) { + $label1 = new Label(); + $label1->setTitle('Important'); + $label1->setCardId(1); + $label2 = new Label(); + $label2->setTitle('Maybe'); + $label2->setCardId(2); + $labels[$i] = [ + $label1, + $label2 + ]; + } + return $labels; + } + private function getStacks() { + $s1 = new Stack(); + $s1->setId(222); + $s2 = new Stack(); + $s2->setId(223); + return [$s1, $s2]; + } + private function getCards($stackId=0) { + $cards = []; + for ($i=0;$i<10;$i++) { + $cards[$i] = new Card(); + $cards[$i]->setId($i); + $cards[$i]->setStackId($stackId); + } + return $cards; + } + + public function testCreate() { + $this->permissionService->expects($this->once())->method('checkPermission'); + $stack = new Stack(); + $stack->setId(123); + $stack->setTitle('Foo'); + $stack->setBoardId(2); + $stack->setOrder(1); + $this->stackMapper->expects($this->once())->method('insert')->willReturn($stack); + $result = $this->stackService->create('Foo', 2, 1); + $this->assertEquals($stack, $result); + } + + public function testDelete() { + $this->permissionService->expects($this->once())->method('checkPermission'); + $this->stackMapper->expects($this->once())->method('find')->willReturn(new Stack()); + $this->stackMapper->expects($this->once())->method('delete'); + $this->stackService->delete(123); + } + + public function testUpdate() { + $this->permissionService->expects($this->once())->method('checkPermission'); + $stack = new Stack(); + $this->stackMapper->expects($this->once())->method('find')->willReturn($stack); + $this->stackMapper->expects($this->once())->method('update')->willReturn($stack); + $stack->setId(123); + $stack->setTitle('Foo'); + $stack->setBoardId(2); + $stack->setOrder(1); + $result = $this->stackService->update(123, 'Foo', 2, 1); + $this->assertEquals($stack, $result); + + } + +} \ No newline at end of file