How do I mock a protected property of a an object.
besrabasant opened this issue · 1 comments
besrabasant commented
Given
Class A {
protected $x = false;
public function methodA()
{
if($x){ return 'FOO'; }
return 'BAR';
}
}
My test is -
$a = new A();
\Aspectmock\Test::double($a,['x' => true]);
$this->assertEquals('BAR', $a->methodA() );
I get null
.
How do I solve this?
zuozp8 commented
it's not connected to AspectMock, http://php.net/manual/en/reflectionproperty.setvalue.php