summaryrefslogtreecommitdiff
path: root/tests/units/ExternalLink/FileLinkTest.php
blob: b83000cd024a568797117da9d563f92ff66e99d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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());
    }
}