summaryrefslogtreecommitdiff
path: root/tests/integration/LinkProcedureTest.php
diff options
context:
space:
mode:
authorJLGC @monolinux <monolinux@junglacode.org>2016-08-15 23:13:16 -0500
committerJLGC @monolinux <monolinux@junglacode.org>2016-08-15 23:13:16 -0500
commit683c0464093f6a7976236c68653c2a2cc5dae280 (patch)
treebf176ecd82415cc4952eea071b7d264dd5fd68b4 /tests/integration/LinkProcedureTest.php
parentb1e795fc5b45369f7b9b565b1e106d2673361977 (diff)
parent5f82a942c0011bf91947b2c1d627c0907bda0c92 (diff)
Merge https://github.com/kanboard/kanboard
Diffstat (limited to 'tests/integration/LinkProcedureTest.php')
-rw-r--r--tests/integration/LinkProcedureTest.php70
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/integration/LinkProcedureTest.php b/tests/integration/LinkProcedureTest.php
new file mode 100644
index 00000000..fb07e694
--- /dev/null
+++ b/tests/integration/LinkProcedureTest.php
@@ -0,0 +1,70 @@
+<?php
+
+require_once __DIR__.'/BaseProcedureTest.php';
+
+class LinkProcedureTest extends BaseProcedureTest
+{
+ public function testGetAllLinks()
+ {
+ $links = $this->app->getAllLinks();
+ $this->assertNotEmpty($links);
+ $this->assertArrayHasKey('id', $links[0]);
+ $this->assertArrayHasKey('label', $links[0]);
+ $this->assertArrayHasKey('opposite_id', $links[0]);
+ }
+
+ public function testGetOppositeLink()
+ {
+ $link = $this->app->getOppositeLinkId(1);
+ $this->assertEquals(1, $link);
+
+ $link = $this->app->getOppositeLinkId(2);
+ $this->assertEquals(3, $link);
+ }
+
+ public function testGetLinkByLabel()
+ {
+ $link = $this->app->getLinkByLabel('blocks');
+ $this->assertNotEmpty($link);
+ $this->assertEquals(2, $link['id']);
+ $this->assertEquals(3, $link['opposite_id']);
+ }
+
+ public function testGetLinkById()
+ {
+ $link = $this->app->getLinkById(4);
+ $this->assertNotEmpty($link);
+ $this->assertEquals(4, $link['id']);
+ $this->assertEquals(5, $link['opposite_id']);
+ $this->assertEquals('duplicates', $link['label']);
+ }
+
+ public function testCreateLink()
+ {
+ $link_id = $this->app->createLink(array('label' => 'test'));
+ $this->assertNotFalse($link_id);
+ $this->assertInternalType('int', $link_id);
+
+ $link_id = $this->app->createLink(array('label' => 'foo', 'opposite_label' => 'bar'));
+ $this->assertNotFalse($link_id);
+ $this->assertInternalType('int', $link_id);
+ }
+
+ public function testUpdateLink()
+ {
+ $link1 = $this->app->getLinkByLabel('bar');
+ $this->assertNotEmpty($link1);
+
+ $link2 = $this->app->getLinkByLabel('test');
+ $this->assertNotEmpty($link2);
+
+ $this->assertNotFalse($this->app->updateLink($link1['id'], $link2['id'], 'my link'));
+
+ $link = $this->app->getLinkById($link1['id']);
+ $this->assertNotEmpty($link);
+ $this->assertEquals($link2['id'], $link['opposite_id']);
+ $this->assertEquals('my link', $link['label']);
+
+ $this->assertTrue($this->app->removeLink($link1['id']));
+ }
+}