diff options
Diffstat (limited to 'tests/units')
-rw-r--r-- | tests/units/Core/TemplateTest.php | 4 | ||||
-rw-r--r-- | tests/units/Model/GroupMemberTest.php | 30 |
2 files changed, 32 insertions, 2 deletions
diff --git a/tests/units/Core/TemplateTest.php b/tests/units/Core/TemplateTest.php index 9584c831..453f0b14 100644 --- a/tests/units/Core/TemplateTest.php +++ b/tests/units/Core/TemplateTest.php @@ -25,7 +25,7 @@ class TemplateTest extends Base { $template = new Template($this->container['helper']); $this->assertStringEndsWith( - implode(DIRECTORY_SEPARATOR, array('app', 'Core', '..', '..', 'plugins', 'Myplugin', 'Template', 'a', 'b.php')), + implode(DIRECTORY_SEPARATOR, array(PLUGINS_DIR, 'Myplugin', 'Template', 'a', 'b.php')), $template->getTemplateFile('myplugin:a'.DIRECTORY_SEPARATOR.'b') ); } @@ -36,7 +36,7 @@ class TemplateTest extends Base $template->setTemplateOverride('a'.DIRECTORY_SEPARATOR.'b', 'myplugin:c'); $this->assertStringEndsWith( - implode(DIRECTORY_SEPARATOR, array('app', 'Core', '..', '..', 'plugins', 'Myplugin', 'Template', 'c.php')), + implode(DIRECTORY_SEPARATOR, array(PLUGINS_DIR, 'Myplugin', 'Template', 'c.php')), $template->getTemplateFile('a'.DIRECTORY_SEPARATOR.'b') ); diff --git a/tests/units/Model/GroupMemberTest.php b/tests/units/Model/GroupMemberTest.php index 16f769e8..0ff9fdf6 100644 --- a/tests/units/Model/GroupMemberTest.php +++ b/tests/units/Model/GroupMemberTest.php @@ -72,5 +72,35 @@ class GroupMemberTest extends Base $this->assertCount(2, $users); $this->assertEquals('admin', $users[0]['username']); $this->assertEquals('user1', $users[1]['username']); + + $groups = $groupMemberModel->getGroups(1); + $this->assertCount(1, $groups); + $this->assertEquals(1, $groups[0]['id']); + $this->assertEquals('Group A', $groups[0]['name']); + + $groups = $groupMemberModel->getGroups(2); + $this->assertCount(1, $groups); + $this->assertEquals(1, $groups[0]['id']); + $this->assertEquals('Group A', $groups[0]['name']); + + $groups = $groupMemberModel->getGroups(3); + $this->assertCount(1, $groups); + $this->assertEquals(2, $groups[0]['id']); + $this->assertEquals('Group B', $groups[0]['name']); + + $groups = $groupMemberModel->getGroups(4); + $this->assertCount(1, $groups); + $this->assertEquals(2, $groups[0]['id']); + $this->assertEquals('Group B', $groups[0]['name']); + + $groups = $groupMemberModel->getGroups(5); + $this->assertCount(2, $groups); + $this->assertEquals(1, $groups[0]['id']); + $this->assertEquals('Group A', $groups[0]['name']); + $this->assertEquals(2, $groups[1]['id']); + $this->assertEquals('Group B', $groups[1]['name']); + + $groups = $groupMemberModel->getGroups(6); + $this->assertCount(0, $groups); } } |