Loads dependencies to mocked classes by Mockery for Nette Framework.
Banned Classes
Data entities, classes with different implementations of mockery magic (e.g. __getStatic()
) etc.
Spamer\DependencyMocker\Mocker::setBannedClasses([
App\Entity\BaseEntity::class,
App\GetStatic::class,
]);
$basePresenter = Spamer\DependencyMocker\Mocker::mockClassDependencies(App\BasePresenter::class);
Methods in BasePresenter:
$basePresenter->shouldReceive('add')->andReturn(1);
Accessing dependencies of BasePresenter and setting up Mockery logic.
Spamer\DependencyMocker\Mocker::getProperty(
App\BasePresenter::class,
'articleModel',
$basePresenter
)
->shouldReceive('save')->once();
$basePresenter->articleModel->shouldReceive('save')->once();