diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-01-22 21:23:12 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-01-22 21:23:12 -0500 |
commit | ad8fcf035ab92d8cd06179959000b9a1681b1505 (patch) | |
tree | 80f4e35b16c1c1a6d4c473983bc6cb62b9519494 /tests/integration/GroupTest.php | |
parent | f27bcec2d92af83ee7205c84954cda9d7b2fc55d (diff) |
Add new API procedures for groups, roles and project permissions
Diffstat (limited to 'tests/integration/GroupTest.php')
-rw-r--r-- | tests/integration/GroupTest.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/integration/GroupTest.php b/tests/integration/GroupTest.php new file mode 100644 index 00000000..7a5bccc9 --- /dev/null +++ b/tests/integration/GroupTest.php @@ -0,0 +1,48 @@ +<?php + +require_once __DIR__.'/Base.php'; + +class GroupTest extends Base +{ + public function testCreateGroup() + { + $this->assertNotFalse($this->app->createGroup('My Group A')); + $this->assertNotFalse($this->app->createGroup('My Group B', '1234')); + } + + public function testGetter() + { + $groups = $this->app->getAllGroups(); + $this->assertCount(2, $groups); + $this->assertEquals('My Group A', $groups[0]['name']); + $this->assertEquals('', $groups[0]['external_id']); + $this->assertEquals('My Group B', $groups[1]['name']); + $this->assertEquals('1234', $groups[1]['external_id']); + + $group = $this->app->getGroup($groups[0]['id']); + $this->assertNotEmpty($group); + $this->assertEquals('My Group A', $group['name']); + $this->assertEquals('', $group['external_id']); + } + + public function testUpdate() + { + $groups = $this->app->getAllGroups(); + + $this->assertTrue($this->app->updateGroup(array('group_id' => $groups[0]['id'], 'name' => 'ABC', 'external_id' => 'something'))); + $this->assertTrue($this->app->updateGroup(array('group_id' => $groups[1]['id'], 'external_id' => ''))); + + $groups = $this->app->getAllGroups(); + $this->assertEquals('ABC', $groups[0]['name']); + $this->assertEquals('something', $groups[0]['external_id']); + $this->assertEquals('', $groups[1]['external_id']); + } + + public function testRemove() + { + $groups = $this->app->getAllGroups(); + $this->assertTrue($this->app->removeGroup($groups[0]['id'])); + $this->assertTrue($this->app->removeGroup($groups[1]['id'])); + $this->assertSame(array(), $this->app->getAllGroups()); + } +} |