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 = '
'; $this->assertEquals($result, $expected); $result = $this->abc->formTag('foo', 'get'); $expected = ''; $this->assertEquals($result, $expected); $result = $this->abc->formTag('/bar/baz', 'file'); $expected = ''; $this->assertEquals($result, $expected); } function testSubmitTag () { $result = $this->abc->submitTag(); $expected = ''; $this->assertEquals($result, $expected); $result = $this->abc->submitTag('Foo', array('class'=>'Bar')); $expected = ''; $this->assertEquals($result, $expected); } function testInputTag () { $result = $this->abc->inputTag('foo'); $expected = ''; $this->assertEquals($result, $expected); $result = $this->abc->inputTag('bar', 20, array('class'=>'Foobar')); $expected = ''; $this->assertEquals($result, $expected); } function testPasswordTag () { $result = $this->abc->passwordTag('foo'); $expected = ''; $this->assertEquals($result, $expected); $result = $this->abc->passwordTag('foo', 33, array('class'=>'Bar')); $expected = ''; $this->assertEquals($result, $expected); } function testHiddenTag () { $result = $this->abc->hiddenTag('foo'); $expected = ''; $this->assertEquals($result, $expected); $result = $this->abc->hiddenTag('bar', 'baz'); $expected = ''; $this->assertEquals($result, $expected); $result = $this->abc->hiddenTag('foobar', null, array('class'=>'Bar')); $expected = ''; $this->assertEquals($result, $expected); } function testFileTag () { $result = $this->abc->fileTag('bar', array('class'=>'Foo', 'disabled'=>'1')); $expected = ''; $this->assertEquals($result, $expected); } function testAreaTag () { $result = $this->abc->areaTag('foo'); $expected = ''; $this->assertEquals($result, $expected); $result = $this->abc->areaTag('foo', 33, 33, array('class'=>'Bar')); $expected = ''; $this->assertEquals($result, $expected); } function testCheckboxTag () { $result = $this->abc->checkboxTag('bar'); $expected = ''; $this->assertEquals($result, $expected); $result = $this->abc->checkboxTag('tofu', 'ToFu title', array('class'=>'Baz')); $expected = ''; $this->assertEquals($result, $expected); } function testRadioTags () { $result = $this->abc->radioTags('foo', array('foo'=>'Foo', 'bar'=>'Bar'), '---', array('class'=>'Foo')); $expected = '---'; $this->assertEquals($result, $expected); $result = $this->abc->radioTags('bar', array()); $expected = null; $this->assertEquals($result, $expected); } function testSelectTag () { $result = $this->abc->selectTag('tofu', array('m'=>'male', 'f'=>'female'), array('class'=>'Outer'), array('class'=>'Inner', 'id'=>'FooID')); $expected = ''; $this->assertEquals($result, $expected); $result = $this->abc->selectTag('tofu', array()); $expected = null; $this->assertEquals($result, $expected); } function testTableHeaders () { $result = $this->abc->tableHeaders(array('One', 'Two', 'Three')); $expected = 'One Two Three'; $this->assertEquals($result, $expected); $result = $this->abc->tableHeaders(array('Foo Bar', 'Baz'), array('class'=>'Eco'), array('align'=>'left')); $expected = 'Foo Bar Baz'; $this->assertEquals($result, $expected); } function testTableCells () { $result = $this->abc->tableCells(array('Foo', 'Bar')); $expected = 'Foo Bar'; $this->assertEquals($result, $expected); $result = $this->abc->tableCells(array(array('Foo','Bar'),array('Baz','Echo'),array('Nul','Pio')), array('class'=>'Mini'), array('align'=>'left')); $expected = join("\n", array('Foo Bar', 'Baz Echo', 'Nul Pio')); $this->assertEquals($result, $expected); } function testImageTag () { $result = $this->abc->imageTag('foo.gif'); $expected = ''; $this->assertEquals($result, $expected); $result = $this->abc->imageTag('bar/baz.gif', 'Foobar', array('class'=>'Zet')); $expected = 'Foobar'; $this->assertEquals($result, $expected); } function testTagValue () { $result = $this->abc->tagValue('foo'); $expected = 'foo_value'; $this->assertEquals($result, $expected); $result = $this->abc->tagValue('bar'); $expected = false; $this->assertEquals($result, $expected); } function testGetCrumbs () { $this->abc->addCrumb('Foo', '/bar/foo'); $result = $this->abc->getCrumbs(); $expected = 'START » Foo'; $this->assertEquals($result, $expected); } /* function test () { $result = $this->abc->(); $expected = ''; $this->assertEquals($result, $expected); } */ } ?>