diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-07-31 15:10:42 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-07-31 15:10:42 -0400 |
commit | 86c950743f2d923a37de3f3a91344dae62a1015e (patch) | |
tree | 291e1f54712946ea2a3f017249705d9aa99db712 /tests | |
parent | 9f2ef84cd08607d1b4df0ab31f70eda65ea9ee83 (diff) |
Move API calls for task metadata to a separate class
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/TaskMetadataProcedureTest.php | 45 | ||||
-rw-r--r-- | tests/integration/TaskProcedureTest.php | 38 |
2 files changed, 45 insertions, 38 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'); + } +} diff --git a/tests/integration/TaskProcedureTest.php b/tests/integration/TaskProcedureTest.php index 8b3e622c..f456ae52 100644 --- a/tests/integration/TaskProcedureTest.php +++ b/tests/integration/TaskProcedureTest.php @@ -5,7 +5,6 @@ require_once __DIR__.'/BaseProcedureTest.php'; class TaskProcedureTest extends BaseProcedureTest { protected $projectName = 'My project to test tasks'; - protected $metaKey = 'MyTestMetaKey'; public function testAll() { @@ -16,43 +15,6 @@ class TaskProcedureTest extends BaseProcedureTest $this->assertGetTaskByReference(); $this->assertGetAllTasks(); $this->assertOpenCloseTask(); - $this->assertSaveTaskMetadata(); - $this->assertGetTaskMetadata(); - $this->assertGetTaskMetadataByName(); - $this->assertRemoveTaskMetadata(); - } - - public function assertSaveTaskMetadata() - { - $createMetaKey = $this->app->saveTaskMetadata($this->taskId, array($this->metaKey => 'metaValue1')); - $this->assertTrue($createMetaKey); - } - - public function assertGetTaskMetadata() - { - $createMetaKey = $this->app->saveTaskMetadata($this->taskId, array($this->metaKey => 'metaValue1')); - $this->assertTrue($createMetaKey,'Did not create metakey with success'); - $metaData = $this->app->getTaskMetadata(($this->taskId)); - $this->assertArrayHasKey($this->metaKey, $metaData); - $this->assertEquals('metaValue1', $metaData[$this->metaKey]); - } - - public function assertGetTaskMetadataByName() - { - $createMetaKey = $this->app->saveTaskMetadata($this->taskId, array($this->metaKey => 'metaValue1')); - $this->assertTrue($createMetaKey,'Did not create metakey with success'); - $metaValue = $this->app->getTaskMetadataByName($this->taskId,$this->metaKey); - $this->assertEquals('metaValue1', $metaValue, 'Did not return correct metadata value'); - } - - public function assertRemoveTaskMetadata() - { - $createMetaKey = $this->app->saveTaskMetadata($this->taskId, array($this->metaKey => 'metaValue1')); - $this->assertTrue($createMetaKey,'Did not create metakey with success'); - $metaValue = $this->app->removeTaskMetadata($this->taskId,$this->metaKey); - $this->assertTrue($metaValue,'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'); } public function assertUpdateTask() |