Answer the question
In order to leave comments, you need to log in
How to test a class method that calls the void method of a property of that class and changes the state of that class?
There are classes:
class Aaa {
private $bbb;
public $some_property = 10;
function __construct(B $bbb){
$this->bbb = $bbb;
}
public function some_func(){
// ...
$bbb->change_aaa_property($this);
// ...
}
}
class Bbb {
function change_aaa_property(A $aaa){
$aaa->some_property += 10;
}
}
Answer the question
In order to leave comments, you need to log in
$bbb = new Bbb();
$aaa = new Aaa($bbb);
$aaa->some_func();
$this->assertEquals(20, $aaa->some_property);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question