diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-04-19 14:48:12 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-04-19 14:48:12 -0400 |
commit | 1891e87d035c235550b5889da585e166cf49502f (patch) | |
tree | a6100a70184e635788aaed4071ca968a0fde3088 /tests/units/ProjectTest.php | |
parent | 370b5a0fd7c1dba60e3b973506ba087adba42be0 (diff) |
Add Postmark integration (inbound emails for task creation)
Diffstat (limited to 'tests/units/ProjectTest.php')
-rw-r--r-- | tests/units/ProjectTest.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/units/ProjectTest.php b/tests/units/ProjectTest.php index 4864a3ae..231d403f 100644 --- a/tests/units/ProjectTest.php +++ b/tests/units/ProjectTest.php @@ -203,4 +203,57 @@ class ProjectTest extends Base $this->assertFalse($p->disablePublicAccess(123)); } + + public function testIdentifier() + { + $p = new Project($this->container); + + // Creation + $this->assertEquals(1, $p->create(array('name' => 'UnitTest1', 'identifier' => 'test1'))); + $this->assertEquals(2, $p->create(array('name' => 'UnitTest2'))); + + $project = $p->getById(1); + $this->assertNotEmpty($project); + $this->assertEquals('TEST1', $project['identifier']); + + $project = $p->getById(2); + $this->assertNotEmpty($project); + $this->assertEquals('', $project['identifier']); + + // Update + $this->assertTrue($p->update(array('id' => '2', 'identifier' => 'test2'))); + + $project = $p->getById(2); + $this->assertNotEmpty($project); + $this->assertEquals('TEST2', $project['identifier']); + + $project = $p->getByIdentifier('test1'); + $this->assertNotEmpty($project); + $this->assertEquals('TEST1', $project['identifier']); + + // Validation rules + $r = $p->validateCreation(array('name' => 'test', 'identifier' => 'TEST1')); + $this->assertFalse($r[0]); + + $r = $p->validateCreation(array('name' => 'test', 'identifier' => 'test1')); + $this->assertFalse($r[0]); + + $r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'TEST1')); + $this->assertTrue($r[0]); + + $r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'test3')); + $this->assertTrue($r[0]); + + $r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => '')); + $this->assertTrue($r[0]); + + $r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'TEST2')); + $this->assertFalse($r[0]); + + $r = $p->validateCreation(array('name' => 'test', 'identifier' => 'a-b-c')); + $this->assertFalse($r[0]); + + $r = $p->validateCreation(array('name' => 'test', 'identifier' => 'test 123')); + $this->assertFalse($r[0]); + } } |