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