From 9bd7985ba41b385c63213970b862ffc06f1096b0 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 6 Dec 2015 00:00:09 -0500 Subject: Add more unit tests --- tests/units/Core/Group/GroupManagerTest.php | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tests/units/Core/Group/GroupManagerTest.php (limited to 'tests/units/Core') diff --git a/tests/units/Core/Group/GroupManagerTest.php b/tests/units/Core/Group/GroupManagerTest.php new file mode 100644 index 00000000..faf5501f --- /dev/null +++ b/tests/units/Core/Group/GroupManagerTest.php @@ -0,0 +1,42 @@ +container); + $groupManager = new GroupManager; + + $this->assertEquals(1, $groupModel->create('Group 1')); + $this->assertEquals(2, $groupModel->create('Group 2')); + + $this->assertEmpty($groupManager->find('group 1')); + + $groupManager->register(new DatabaseBackendGroupProvider($this->container)); + $groupManager->register(new DatabaseBackendGroupProvider($this->container)); + + $groups = $groupManager->find('group 1'); + $this->assertCount(1, $groups); + $this->assertInstanceOf('Kanboard\Group\DatabaseGroupProvider', $groups[0]); + $this->assertEquals('Group 1', $groups[0]->getName()); + $this->assertEquals('', $groups[0]->getExternalId()); + $this->assertEquals(1, $groups[0]->getInternalId()); + + $groups = $groupManager->find('grou'); + $this->assertCount(2, $groups); + $this->assertInstanceOf('Kanboard\Group\DatabaseGroupProvider', $groups[0]); + $this->assertInstanceOf('Kanboard\Group\DatabaseGroupProvider', $groups[1]); + $this->assertEquals('Group 1', $groups[0]->getName()); + $this->assertEquals('Group 2', $groups[1]->getName()); + $this->assertEquals('', $groups[0]->getExternalId()); + $this->assertEquals('', $groups[1]->getExternalId()); + $this->assertEquals(1, $groups[0]->getInternalId()); + $this->assertEquals(2, $groups[1]->getInternalId()); + } +} -- cgit v1.2.3