Answer the question
In order to leave comments, you need to log in
How to put a stub on a method with an associated model?
Actually the question is in the following there is such a code
$sessionResourceOption->resourceOptions->getSeatsCount();
public function getResourceOptions()
{
return $this->hasOne(ResourceOptions::className(), ['id' => 'resource_options_id']);
}
$this->getSeatsCount=Stub::make(new ResourceOptions(),['getSeatsCount'=2]);
$this->sessionResourceOption=Stub::make(new BookingSessionResourceOption (),'resourceOptions',$this->getSeatsCount)
Could not add property resourceOptions, class app\models\BookingSessionResourceOption implements __set method, and no resourceOptions property exists
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question