我想编写一个测试以确保变量受到保护。那可能吗?这就是我得到的。
/**
* @expectedException Fatal error
* @expectedExceptionMessage Cannot access protected property
*/
public function testCannotAccessProtectedProperty() {
$this->assertEquals($this->object->variableiwanttotest[0], $value);
}
这是错误消息
PHP Fatal error: Cannot access protected property Object::variableiwanttotest in /Users/confidential/ObjectTest.php on line 25