I'm working with laravel 5.5
And I need to test is method called on an object which is create inside other class.
How could I do it?
Example:
class A {
public static function createQuery($variable){
$b = new B($variable);
if($variable === 1){
$b->withShoes();
}
if($variable === 2){
$b->withSocks();
}
if($variable === 1 || $variable === 3){
$b->withFriends();
}
return $b->get();
}
}
class B {
public function withShoes(){
...
}
public function withSocks(){
...
}
public function withFriends(){
...
}
public function get(){
...
}
}
I would like do make some test like:
Was it call out 'withShoes()'method when I called out A::createQuery($variable).
Thanks for any help.
Aucun commentaire:
Enregistrer un commentaire