Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/07/2009, 21:27
ratamaster
 
Fecha de Ingreso: octubre-2004
Ubicación: En algún lugar de la República Oriental del Uruguay
Mensajes: 366
Antigüedad: 20 años, 4 meses
Puntos: 0
Problema con PHPUNIT con el fixture

Hola, estoy teniendo un error cuando llamo al método get_var() de la clase ezSQL_mysql
Dentro del método setUp definí $this->db = new ezSQL_mysql; por lo tanto supongo que esta variable será accesible en todos los métodos.
Pero cuando ejecuto testTableProject, tengo un error en $this->db->get_var:

Fatal error: Call to a member function get_var() on a non-object in C:\AppServ\www\iap\Test\project\Iap\ProjectTest.ph p on line 43

Código PHP:
class tableTest extends PHPUnit_Framework_TestCase
{
 
   protected 
$db;
    
   
   public function 
setUp()
   {      
      
$this->db = new ezSQL_mysql;
      
      echo 
$this->db->get_var("SELECT COUNT(*) FROM myTable"); //ESTO FUNCIONA
 
   
}
   
   public function 
tearDown()
   {
        unset(
$this->db);
   }
 
   
   public function 
testTableProject()
   {
   
      
      echo 
$num $this->db->get_var("SELECT COUNT(*) FROM myTable"); //ESTO NO FUNCIONA
 
      
$this->assertEquals(1$num);
   }
 
}
 
$tableTest = new tableTest();
$tableTest->testTableProject(); 

Soy nuevo en phpunit, tal vez estoy haciendo algo mal
Gracias!
__________________
ratamaster