Using SimpleTest in PHP5
Posted: Mon Apr 26, 2010 1:14 pm
I'm trying to learn how to use the SimpleTest Library. I found a simple example of how to try it out:
This is a PHP4 Example and I'm using PHP5 and getting the error:
"Assigning the return value of new by reference is deprecated"
I read something about passing an object as reference instead of value with the different versions but I'm not quite sure where/how/why its happening.
Code: Select all
define('TAX_RATE', 0.07);
define('URL', $_SERVER['DOCUMENT_ROOT']);
function caluclate_sales_tax($amount) {
round($amount * TAX_RATE, 2);
}
// Include Test Library
require_once URL.'/simpletest/unit_tester.php';
require_once URL.'/simpletest/reporter.php';
// The test
class TestingTestCase extends UnitTestCase {
public function TestingTestCase($name=''){
$this->UnitTestCase($name);
}
public function TestSalesTax(){
$this->assertEqual(7, calculate_sales_tax(100));
}
}
$test = new TestingTestCase('Testing Unit Test');
$test->run(new htmlReporter());
"Assigning the return value of new by reference is deprecated"
I read something about passing an object as reference instead of value with the different versions but I'm not quite sure where/how/why its happening.