Minimal Code
<?php
class ConfigurationParser {
function parse() {
return array();
}
}
?>
configurationtest
1 passes, 0 fails and 0 exceptions.
<?php
class ConfigurationTest extends UnitTestCase {
function ConfigurationTest() {
$this->UnitTestCase();
}
function testNoLinesGivesEmptyHash() {
$parser = &new ConfigurationParser();
$this->assertIdentical($parser->parse(array()), array());
}
function testKeyValuePair() {
$parser = &new ConfigurationParser();
$this->assertEqual(
$parser->parse(array("a An")),
array('a' => 'A'));
}
}
?>
<?php
class ConfigurationParser {
function parse($lines) {
if ($lines == array("a An")) {
return array('a' => 'A');
}
return array();
}
}
?>