In order to test a method, I need to assure the return type is an InstanceOf a particular object. I order for this particular object to be returned, I need to set a variable that is local to the method I need to test to particular string, in order for a condition to be met and the return statement to be reached. Is it possible to mimic a local variable value in a php unit test? In the below example, I need to mimic the booktype variable as either horror or comedy, in order for the return statement to be reached.
public function createBuilder () {
$bookType = $this->_search->getBookType();
if ($this->isInitialRequest()) {
if ($bookType == "comedy" || $bookType == "horror") {
return new Builder\Aggregate(
$this->_search,
$this->_api,
$this->_app
);
}
}
Aucun commentaire:
Enregistrer un commentaire