diff options
| author | Frederic Guillot <fred@kanboard.net> | 2015-09-05 23:30:56 -0400 |
|---|---|---|
| committer | Frederic Guillot <fred@kanboard.net> | 2015-09-05 23:30:56 -0400 |
| commit | 710f2c7bb046b43ec9878ae795a181101f6d7515 (patch) | |
| tree | b62723b6b49c3b6bf2b3ca41a772f552464a9031 /tests/units/UrlHelperTest.php | |
| parent | 94b38dd94bd819168163003beec8ef693f9d9839 (diff) | |
Improve unit tests
Diffstat (limited to 'tests/units/UrlHelperTest.php')
| -rw-r--r-- | tests/units/UrlHelperTest.php | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/tests/units/UrlHelperTest.php b/tests/units/UrlHelperTest.php deleted file mode 100644 index ebfe9c99..00000000 --- a/tests/units/UrlHelperTest.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -require_once __DIR__.'/Base.php'; - -use Helper\Url; -use Model\Config; - -class UrlHelperTest extends Base -{ - public function testLink() - { - $h = new Url($this->container); - $this->assertEquals( - '<a href="?controller=a&action=b&d=e" class="f" title="g" target="_blank">label</a>', - $h->link('label', 'a', 'b', array('d' => 'e'), false, 'f', 'g', true) - ); - } - - public function testHref() - { - $h = new Url($this->container); - $this->assertEquals( - '?controller=a&action=b&d=e', - $h->href('a', 'b', array('d' => 'e')) - ); - } - - public function testTo() - { - $h = new Url($this->container); - $this->assertEquals( - '?controller=a&action=b&d=e', - $h->to('a', 'b', array('d' => 'e')) - ); - } - - public function testDir() - { - $h = new Url($this->container); - $this->assertEquals('', $h->dir()); - - $_SERVER['REQUEST_METHOD'] = 'GET'; - $_SERVER['PHP_SELF'] = '/plop/index.php'; - $h = new Url($this->container); - $this->assertEquals('/plop/', $h->dir()); - - $_SERVER['REQUEST_METHOD'] = 'GET'; - $_SERVER['PHP_SELF'] = ''; - $h = new Url($this->container); - $this->assertEquals('/', $h->dir()); - } - - public function testServer() - { - $h = new Url($this->container); - - $this->assertEquals('http://localhost/', $h->server()); - - $_SERVER['PHP_SELF'] = '/'; - $_SERVER['SERVER_NAME'] = 'kb'; - $_SERVER['SERVER_PORT'] = 1234; - - $this->assertEquals('http://kb:1234/', $h->server()); - } - - public function testBase() - { - $h = new Url($this->container); - - $this->assertEquals('http://localhost/', $h->base()); - - $_SERVER['PHP_SELF'] = '/'; - $_SERVER['SERVER_NAME'] = 'kb'; - $_SERVER['SERVER_PORT'] = 1234; - - $h = new Url($this->container); - $this->assertEquals('http://kb:1234/', $h->base()); - - $c = new Config($this->container); - $c->save(array('application_url' => 'https://mykanboard/')); - - $h = new Url($this->container); - $this->assertEquals('https://mykanboard/', $c->get('application_url')); - $this->assertEquals('https://mykanboard/', $h->base()); - } -} |
