TestCase($name); } // called before the test functions will be executed // this function is defined in PHPUnit_TestCase and overwritten // here function setUp() { $this->abc = new Controller (); $this->abc->base = '/ease'; $data = array('foo'=>'foo_value', 'foobar'=>'foobar_value', 'tofu'=>'1'); $params = array('controller'=>'Test', 'action'=>'test_action', 'data'=>$data); $this->abc->params = $params; $this->abc->data = $data; $this->abc->action = $this->abc->params['action']; $this->abc->passed_args = null; } // called after the test functions are executed // this function is defined in PHPUnit_TestCase and overwritten // here function tearDown() { unset($this->abc); } function testUrlFor () { $result = $this->abc->urlFor ('/foo/bar'); $expected = '/ease/foo/bar'; $this->assertEquals($result, $expected); $result = $this->abc->urlFor ('baz'); $expected = '/ease/test/baz'; $this->assertEquals($result, $expected); $result = $this->abc->urlFor (); $expected = '/ease/test/test_action'; $this->assertEquals($result, $expected); } function testParseHtmlOptions () { $result = $this->abc->parseHtmlOptions(null); $expected = null; $this->assertEquals($result, $expected); $result = $this->abc->parseHtmlOptions(array()); $expected = null; $this->assertEquals($result, $expected); $result = $this->abc->parseHtmlOptions (array('class'=>'foo')); $expected = ' class="foo"'; $this->assertEquals($result, $expected); $result = $this->abc->parseHtmlOptions (array('class'=>'foo', 'id'=>'bar'), '', ' '); $expected = 'class="foo" id="bar" '; $this->assertEquals($result, $expected); } function testLinkTo() { $result = $this->abc->linkTo ('Testing ó³¼', '/test/ok', array('style'=>'color:Red'), 'Sure?'); $expected = 'Testing ó³¼'; $this->assertEquals($result, $expected); $result = $this->abc->linkTo ('Ok', 'ok'); $expected = 'Ok'; $this->assertEquals($result, $expected); } function testLinkOut () { $result = $this->abc->linkOut ('Sputnik.pl', 'http://www.sputnik.pl/', array('style'=>'color:Red')); $expected = 'Sputnik.pl'; $this->assertEquals($result, $expected); $result = $this->abc->linkOut ('http://sputnik.pl'); $expected = 'http://sputnik.pl'; $this->assertEquals($result, $expected); } function testFormTag () { $result = $this->abc->formTag(); $expected = '