class Testable
{
public$trueProperty=true;
public$resetMe=true;
public$testArray=array(
'first key'=>1,
'second key'=>2
);
private$testString="I do love me some strings";
publicfunction __construct()
{
}
publicfunction addValues($valueOne,$valueTwo) {
return$valueOne+$valueTwo;
}
publicfunction getTestString()
{
return$this->testString;
}
}
?>
我们编写的单元测试代码初步的框架如下:
<?php
class TestableTest extends PHPUnit_Framework_TestCase
{
private$_testable=null;
publicfunction setUp()
{
$this->_testable =new Testable();
}
publicfunction tearDown()
{
$this->_testable =null;
}
/** test methods will go here */
}
?>