/** * Test exception when array does not contain Boards. * * @expectedException \Exception * @expectedExceptionMessage Function ListManager::getList expect an array of Board as second argument */ public function testGetBoardWithWrongName() { $trelloClient = $this->getTrelloClientMock(); $listManager = new ListManager($trelloClient); $board1 = $this->getBoardMock('1'); $board2 = 'test'; $this->assertEmpty($listManager->getList('test list 1', [$board1, $board2])); }
/** * @param array $lists * @param string $listName * @param $boardName * * @throws \Exception */ private function addList(array &$lists, string $listName, $boardName) { if ($boardName !== null) { $board = $this->boardManager->getBoard($boardName); if ($board == null || !$board instanceof Board) { throw new TrelloItemNotFoundException('board', $boardName); } $list = $this->listManager->getListFromBoard($listName, $board); if ($list == null || !$list instanceof Cardlist) { throw new TrelloItemNotFoundException('list', $listName); } $lists[] = $list; } else { $list = $this->listManager->getList($listName, $this->boards); if ($list == null || !$list instanceof Cardlist) { throw new TrelloItemNotFoundException('list', $listName); } $lists[] = $list; } }