hello, just starting to learn unit testing with simple test and not getting off to a good start.
can someone tell me where im going wrong please?
going by the above i should get a 'fail' box but no matter what i try i only ever get the 'pass' boxPHP Code:class authenticator {
private $connection;
public function __construct() {
}
public function is_logged( $username, $password ) {
if( $username == 'user' && $password == 'pass' ) {
return true;
} else {
return false;
}
}
}
class unit_test extends UnitTestCase {
public function __construct() {
$this -> UnitTestCase();
}
public function first_test() {
$auth = new authenticator;
$this -> assertTrue( $auth -> is_logged( 'test', 'pass' ) );
}
}
$test = new unit_test;
$test -> run( new HtmlReporter() );
![]()







Bookmarks