diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-03-17 21:52:40 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-03-17 21:52:40 -0400 |
commit | e3e08d0e3436e3cf2f951321861e1a274cc2ebbd (patch) | |
tree | 1f9586d3fea3cb14a2ade8e5fc6da24df2f212f2 /tests/units/ExternalLink/FileLinkTest.php | |
parent | 18d203225ba31e51155055d406a811a9cfba599a (diff) |
Added local file link provider
Diffstat (limited to 'tests/units/ExternalLink/FileLinkTest.php')
-rw-r--r-- | tests/units/ExternalLink/FileLinkTest.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/units/ExternalLink/FileLinkTest.php b/tests/units/ExternalLink/FileLinkTest.php new file mode 100644 index 00000000..b83000cd --- /dev/null +++ b/tests/units/ExternalLink/FileLinkTest.php @@ -0,0 +1,28 @@ +<?php + +require_once __DIR__.'/../Base.php'; + +use Kanboard\ExternalLink\FileLink; + +class FileLinkTest extends Base +{ + public function testGetTitleFromUrlWithUnixPath() + { + $url = 'file:///tmp/test.txt'; + + $link = new FileLink($this->container); + $link->setUrl($url); + $this->assertEquals($url, $link->getUrl()); + $this->assertEquals('test.txt', $link->getTitle()); + } + + public function testGetTitleFromUrlWithWindowsPath() + { + $url = 'file:///c:\temp\test.txt'; + + $link = new FileLink($this->container); + $link->setUrl($url); + $this->assertEquals($url, $link->getUrl()); + $this->assertEquals('test.txt', $link->getTitle()); + } +} |