Using PHPUnit and building on Jenkins, this is the message that I got:
1) MyClassTest::testIsPropertyExist with data set #1 ('_table_usage') ReflectionException: Property _table_usage does not exist
When my test is:
/**
* @dataProvider testIsPropertyExistDataProvider
*/
public function testReflectionClassIdtTransactionProperty($property)
{
$object = new MyClass();
$class = PHPUnitReflectionClass::getInstance($object);
$response = $class->getProperty($property);
$this->assertTrue(is_int($response) || is_bool($response));
}
public function testIsPropertyExistDataProvider() {
return array(
array('_idt'),
array('_table_usage')
);
}
And my class:
class MyClass
{
private $_idt;
private $_table_usage;
public function __construct()
{
$this->_table_usage = false;
$this->_idt = 1;
}
}
So, i've been using the...
$class = PHPUnitReflectionClass::getInstance($object);
$response = $class->getProperty($property);
... in other tests, and having no problem.
So my doubts is, what am I missing and why the "_idt" exist?
Aucun commentaire:
Enregistrer un commentaire