summaryrefslogtreecommitdiff
path: root/tests/units/ExternalLink/WebLinkProviderTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-01-30 20:38:20 -0500
committerFrederic Guillot <fred@kanboard.net>2016-01-30 20:38:20 -0500
commit5c92f467867b43034b9e66b46b3b465ba9db655c (patch)
treecb0855ea64d8bba3abe4dfe978c5dbabb745911d /tests/units/ExternalLink/WebLinkProviderTest.php
parentec66a779c9158830fe4bb0f96a44eadfe697ef00 (diff)
Add external links for tasks with plugin api
Diffstat (limited to 'tests/units/ExternalLink/WebLinkProviderTest.php')
-rw-r--r--tests/units/ExternalLink/WebLinkProviderTest.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/units/ExternalLink/WebLinkProviderTest.php b/tests/units/ExternalLink/WebLinkProviderTest.php
new file mode 100644
index 00000000..95110ed8
--- /dev/null
+++ b/tests/units/ExternalLink/WebLinkProviderTest.php
@@ -0,0 +1,52 @@
+<?php
+
+require_once __DIR__.'/../Base.php';
+
+use Kanboard\ExternalLink\WebLinkProvider;
+
+class WebLinkProviderTest extends Base
+{
+ public function testGetName()
+ {
+ $webLinkProvider = new WebLinkProvider($this->container);
+ $this->assertEquals('Web Link', $webLinkProvider->getName());
+ }
+
+ public function testGetType()
+ {
+ $webLinkProvider = new WebLinkProvider($this->container);
+ $this->assertEquals('weblink', $webLinkProvider->getType());
+ }
+
+ public function testGetDependencies()
+ {
+ $webLinkProvider = new WebLinkProvider($this->container);
+ $this->assertEquals(array('related' => 'Related'), $webLinkProvider->getDependencies());
+ }
+
+ public function testMatch()
+ {
+ $webLinkProvider = new WebLinkProvider($this->container);
+
+ $webLinkProvider->setUserTextInput('http://kanboard.net/');
+ $this->assertTrue($webLinkProvider->match());
+
+ $webLinkProvider->setUserTextInput('http://kanboard.net/mypage');
+ $this->assertTrue($webLinkProvider->match());
+
+ $webLinkProvider->setUserTextInput(' https://kanboard.net/ ');
+ $this->assertTrue($webLinkProvider->match());
+
+ $webLinkProvider->setUserTextInput('http:// invalid url');
+ $this->assertFalse($webLinkProvider->match());
+
+ $webLinkProvider->setUserTextInput('');
+ $this->assertFalse($webLinkProvider->match());
+ }
+
+ public function testGetLink()
+ {
+ $webLinkProvider = new WebLinkProvider($this->container);
+ $this->assertInstanceOf('\Kanboard\ExternalLink\WebLink', $webLinkProvider->getLink());
+ }
+}