vendredi 22 juillet 2016

Set mocked Eloquent model public attributes

I have a model Model1 that has many Model2.

I am able to mock Model1.

And I need help on how to set its public attributes. What is the best way to achieve this?

$mock = $this->getMockBuilder('Model1')
    ->disableOriginalConstructor()
    ->getMock();
$mock->setAttribute('Model2', array());

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire