<?php // NOTE: // to run these tests, download simpletest (http://www.simpletest.org/) // and place it outside (but at the same level) of the kirby directory. // require_once dirname(__FILE__) . '/../../simpletest/unit_tester.php'; require_once dirname(__FILE__) . '/../../simpletest/reporter.php'; require_once 'session.php'; require_once 'string.php'; require_once 'array.php'; $test = new SessionTest(); $test->run(new HtmlReporter()); $test = new StringTest(); $test->run(new HtmlReporter()); $test = new ArrayTest(); $test->run(new HtmlReporter());
<?php require_once 'PHPUnit/Framework.php'; class ArrayTest extends PHPUnit_Framework_TestCase { public function testNewArrayIsEmpty() { $names = array(); $this->assertEquals(0, sizeof($names)); } public function testArrayContainsAnElement() { $names = array(); $names[] = 'Bob'; $this->assertEquals(1, sizeof($names)); } } $testObject = new ArrayTest(); $testObject->testNewArrayIsEmpty(); $testObject->testArrayContainsAnElement();