diff options
author | JLGC @monolinux <monolinux@junglacode.org> | 2016-08-15 23:13:16 -0500 |
---|---|---|
committer | JLGC @monolinux <monolinux@junglacode.org> | 2016-08-15 23:13:16 -0500 |
commit | 683c0464093f6a7976236c68653c2a2cc5dae280 (patch) | |
tree | bf176ecd82415cc4952eea071b7d264dd5fd68b4 /tests/integration/TaskMetadataProcedureTest.php | |
parent | b1e795fc5b45369f7b9b565b1e106d2673361977 (diff) | |
parent | 5f82a942c0011bf91947b2c1d627c0907bda0c92 (diff) |
Merge https://github.com/kanboard/kanboard
Diffstat (limited to 'tests/integration/TaskMetadataProcedureTest.php')
-rw-r--r-- | tests/integration/TaskMetadataProcedureTest.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/integration/TaskMetadataProcedureTest.php b/tests/integration/TaskMetadataProcedureTest.php new file mode 100644 index 00000000..9b9b2f39 --- /dev/null +++ b/tests/integration/TaskMetadataProcedureTest.php @@ -0,0 +1,45 @@ +<?php + +require_once __DIR__.'/BaseProcedureTest.php'; + +class TaskMetadataProcedureTest extends BaseProcedureTest +{ + protected $projectName = 'My project to test tasks metadata'; + protected $metaKey = 'MyTestMetaKey'; + + public function testAll() + { + $this->assertCreateTeamProject(); + $this->assertCreateTask(); + $this->assertSaveTaskMetadata(); + $this->assertGetTaskMetadata(); + $this->assertGetTaskMetadataByName(); + $this->assertRemoveTaskMetadata(); + } + + public function assertSaveTaskMetadata() + { + $this->assertTrue($this->app->saveTaskMetadata($this->taskId, array($this->metaKey => 'metaValue1'))); + } + + public function assertGetTaskMetadata() + { + $metaData = $this->app->getTaskMetadata(($this->taskId)); + $this->assertArrayHasKey($this->metaKey, $metaData); + $this->assertEquals('metaValue1', $metaData[$this->metaKey]); + } + + public function assertGetTaskMetadataByName() + { + $metaValue = $this->app->getTaskMetadataByName($this->taskId, $this->metaKey); + $this->assertEquals('metaValue1', $metaValue, 'Did not return correct metadata value'); + } + + public function assertRemoveTaskMetadata() + { + $result = $this->app->removeTaskMetadata($this->taskId, $this->metaKey); + $this->assertTrue($result, 'Did not remove metakey with success'); + $metaValue = $this->app->getTaskMetadataByName($this->taskId, $this->metaKey); + $this->assertEquals('', $metaValue, 'Did not return an empty string due to metadata being deleted'); + } +} |