Add more unit tests
This commit is contained in:
parent
91a99c5e6d
commit
bcbc1b78c6
|
|
@ -3,6 +3,7 @@
|
|||
require_once __DIR__.'/Base.php';
|
||||
|
||||
use Model\Config;
|
||||
use Core\Session;
|
||||
|
||||
class ConfigTest extends Base
|
||||
{
|
||||
|
|
@ -29,4 +30,26 @@ class ConfigTest extends Base
|
|||
$this->assertEquals('test', $c->get('board_columns', 'test'));
|
||||
$this->assertEquals(0, $c->get('board_columns', 0));
|
||||
}
|
||||
|
||||
public function testGetWithSession()
|
||||
{
|
||||
$this->container['session'] = new Session;
|
||||
$c = new Config($this->container);
|
||||
|
||||
session_id('test');
|
||||
|
||||
$this->assertTrue(Session::isOpen());
|
||||
|
||||
$this->assertEquals('', $c->get('board_columns'));
|
||||
$this->assertEquals('test', $c->get('board_columns', 'test'));
|
||||
|
||||
$this->container['session']['config'] = array(
|
||||
'board_columns' => 'foo',
|
||||
'empty_value' => 0
|
||||
);
|
||||
|
||||
$this->assertEquals('foo', $c->get('board_columns'));
|
||||
$this->assertEquals('foo', $c->get('board_columns', 'test'));
|
||||
$this->assertEquals('test', $c->get('empty_value', 'test'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__.'/Base.php';
|
||||
|
||||
use Core\Helper;
|
||||
|
||||
class HelperTest extends Base
|
||||
{
|
||||
public function testMarkdown()
|
||||
{
|
||||
$h = new Helper($this->container);
|
||||
|
||||
$this->assertEquals('<p>Test</p>', $h->markdown('Test'));
|
||||
|
||||
$this->assertEquals(
|
||||
'<p>Task <a href="?controller=task&action=show&task_id=123" class="" title="" >#123</a></p>',
|
||||
$h->markdown('Task #123')
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'<p>Task <a href="?controller=a&action=b&c=d&task_id=123" class="" title="" >#123</a></p>',
|
||||
$h->markdown('Task #123', array('controller' => 'a', 'action' => 'b', 'params' => array('c' => 'd')))
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue