I'm started to use PHPUnit, and I want to connect to my database and get some values from it, but as I have to connect to my database through the file 'database.php'.
'database.php' always had this problem with the undefined variable: $connected. So I read something about with the error-reporting message: error_reporting(E_ALL ^ E_NOTICE);
I did fix it earlier to my other files in my Project, but when I use PHPUnit I get this error message: Undefined variable: connected
My testcase file and it's code:
<?php include("database.php"); ?>
<?php
require_once 'person.php';
class PersonTest extends PHPUnit_Framework_TestCase {
public function lookupPerson(){
$result = database::query("select * from Person where forename='Anna'");
$rows = mysql_numrows($result);
for($i=0; $i < $rows; $i++){
$arr[$i] = mysql_result($result, $i, 'forename');
}
return $arr;
}
public function testLooking(){
$arr = PersonTest::lookupPerson();
foreach($arr as $a){
$this->assertEquals('Anna', $a);
}
}
}
?>
So I wonder what can I do?
Regards User
also Alexein