blob: 57d1940ad9e21f4bd0a1c6b6b8ab2c2bf7b97c37 (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<?php
require_once __DIR__.'/Base.php';
use Core\Helper;
use Model\Config;
class HelperTest extends Base
{
public function testMarkdown()
{
$h = new Helper($this->container);
$this->assertEquals('<p>Test</p>', $h->markdown('Test'));
$this->assertEquals(
'<p>Task #123</p>',
$h->markdown('Task #123')
);
$this->assertEquals(
'<p>Task <a href="?controller=a&action=b&c=d&task_id=123">#123</a></p>',
$h->markdown('Task #123', array('controller' => 'a', 'action' => 'b', 'params' => array('c' => 'd')))
);
$this->assertEquals(
'<p>Check that: <a href="http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454">http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454</a></p>',
$h->markdown(
'Check that: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454',
array('controller' => 'a', 'action' => 'b', 'params' => array('c' => 'd'))
)
);
}
public function testGetCurrentBaseUrl()
{
$h = new Helper($this->container);
$_SERVER['PHP_SELF'] = '/';
$_SERVER['SERVER_NAME'] = 'localhost';
$_SERVER['SERVER_PORT'] = 1234;
$this->assertEquals('http://localhost:1234/', $h->getCurrentBaseUrl());
$c = new Config($this->container);
$c->save(array('application_url' => 'https://mykanboard/'));
$this->assertEquals('https://mykanboard/', $c->get('application_url'));
$this->assertEquals('https://mykanboard/', $h->getCurrentBaseUrl());
}
}
|