diff --git a/tests/miniMVCTest.php b/tests/miniMVCTest.php index 19fc69c..1bf694e 100644 --- a/tests/miniMVCTest.php +++ b/tests/miniMVCTest.php @@ -3,6 +3,9 @@ require_once('simpletest/autorun.php'); require_once('../src/sys/common.php'); +/** + * Test class for /src/sys/common.php + */ class commonTest extends UnitTestCase { function __construct() @@ -19,7 +22,9 @@ class commonTest extends UnitTestCase { function tearDown() { - + unset($this->empty); + unset($this->object); + unset($this->array_like); } function testCreation() @@ -33,6 +38,45 @@ class commonTest extends UnitTestCase { } +// -------------------------------------------------------------------------- + +/** + * Test Class for JSObject class + */ +class JSObjectTest extends UnitTestCase { + + function __construct() + { + parent::__construct('JSObject Class Tests'); + } + + function setUp() + { + $this->JSO = new JSObject(array( + 'foo' => 54, + 'bar' => 'baz', + )); + } + + function tearDown() + { + unset($this->JSO); + } + + function testCreation() + { + + // __toString produces same output as print_r by default + $this->assertIdentical($this->JSO->__toString(), '
'.print_r($this->JSO, TRUE).'
'); + } + +} + +// -------------------------------------------------------------------------- + +/** + * Test class for miniMVC class + */ class miniMVCTest extends UnitTestCase { function __construct() @@ -62,35 +106,38 @@ class miniMVCTest extends UnitTestCase { // miniMVC extends JSObject, right? $this->assertIsA($this->mm, 'JSObject'); + // Invoke function should return the same reference than miniMVC::get_instance() does + $mm = $this->mm; + $this->assertIdentical($mm(), miniMVC::get_instance()); + $this->assertIdentical($this->mm->__invoke(), miniMVC::get_instance()); + } } -class JSObjectTest extends UnitTestCase { +// -------------------------------------------------------------------------- + +class DBTest extends UnitTestCase { function __construct() { - parent::__construct('JSObject Class Tests'); + } function setUp() { - $this->JSO = new JSObject(array( - 'foo' => 54, - 'bar' => 'baz', - )); + } function tearDown() { - unset($this->JSO); + } - + function testCreation() { - // __toString produces same output as print_r by default - $this->assertIdentical($this->JSO->__toString(), '
'.print_r($this->JSO, TRUE).'
'); } -} \ No newline at end of file +} +