diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-01-24 16:29:14 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-01-24 16:29:14 -0500 |
commit | 4fa38bf417dd7f1673f63641460092bd046d57b7 (patch) | |
tree | 6c3a0e7ea2638bd3224cfeb9c9cb1ed3d79f82b2 /tests/units/Model | |
parent | 203754649e08dadeb631c2adfb0ccf4819dda941 (diff) |
Add project owner
Diffstat (limited to 'tests/units/Model')
-rw-r--r-- | tests/units/Model/ProjectTest.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/units/Model/ProjectTest.php b/tests/units/Model/ProjectTest.php index 1b3d5be3..afd047b0 100644 --- a/tests/units/Model/ProjectTest.php +++ b/tests/units/Model/ProjectTest.php @@ -281,4 +281,28 @@ class ProjectTest extends Base $project = $p->getByIdentifier(''); $this->assertFalse($project); } + + public function testThatProjectCreatorAreAlsoOwner() + { + $projectModel = new Project($this->container); + $userModel = new User($this->container); + + $this->assertEquals(2, $userModel->create(array('username' => 'user1', 'name' => 'Me'))); + $this->assertEquals(1, $projectModel->create(array('name' => 'My project 1'), 2)); + $this->assertEquals(2, $projectModel->create(array('name' => 'My project 2'))); + + $project = $projectModel->getByIdWithOwner(1); + $this->assertNotEmpty($project); + $this->assertSame('My project 1', $project['name']); + $this->assertSame('Me', $project['owner_name']); + $this->assertSame('user1', $project['owner_username']); + $this->assertEquals(2, $project['owner_id']); + + $project = $projectModel->getByIdWithOwner(2); + $this->assertNotEmpty($project); + $this->assertSame('My project 2', $project['name']); + $this->assertEquals('', $project['owner_name']); + $this->assertEquals('', $project['owner_username']); + $this->assertEquals(0, $project['owner_id']); + } } |