summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-04 16:03:29 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-04 16:03:29 -0500
commitd5c4c18ea0bd6c0d1a9d0104c1c17748a35f85a7 (patch)
tree313e42064e41c0b4da565d98992f5aa2933dd8ed /tests
parent8eac12188865f380439a40549e6e6ed58c3f405c (diff)
Add email address field for projects
Diffstat (limited to 'tests')
-rw-r--r--tests/units/Model/ProjectModelTest.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/units/Model/ProjectModelTest.php b/tests/units/Model/ProjectModelTest.php
index cd86b654..1f65cad7 100644
--- a/tests/units/Model/ProjectModelTest.php
+++ b/tests/units/Model/ProjectModelTest.php
@@ -298,6 +298,39 @@ class ProjectModelTest extends Base
$this->assertFalse($project);
}
+ public function testEmail()
+ {
+ $projectModel = new ProjectModel($this->container);
+
+ // Creation
+ $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest1', 'email' => 'test1@localhost')));
+ $this->assertEquals(2, $projectModel->create(array('name' => 'UnitTest2')));
+
+ $project = $projectModel->getById(1);
+ $this->assertNotEmpty($project);
+ $this->assertEquals('test1@localhost', $project['email']);
+
+ $project = $projectModel->getById(2);
+ $this->assertNotEmpty($project);
+ $this->assertEquals('', $project['email']);
+
+ // Update
+ $this->assertTrue($projectModel->update(array('id' => '1', 'email' => 'test1@here')));
+
+ $project = $projectModel->getById(1);
+ $this->assertNotEmpty($project);
+ $this->assertEquals('test1@here', $project['email']);
+
+ $project = $projectModel->getByEmail('test1@here');
+ $this->assertEquals(1, $project['id']);
+
+ $project = $projectModel->getByEmail('test1@localhost');
+ $this->assertEmpty($project);
+
+ $project = $projectModel->getByEmail('');
+ $this->assertFalse($project);
+ }
+
public function testThatProjectCreatorAreAlsoOwner()
{
$projectModel = new ProjectModel($this->container);