2
0
Fork 0
mirror of https://github.com/koel/koel synced 2025-01-08 10:48:43 +00:00
koel/tests/Traits/InteractsWithIoc.php

19 lines
478 B
PHP

<?php
namespace Tests\Traits;
use Mockery;
use Mockery\MockInterface;
trait InteractsWithIoc
{
/**
* Mock an IOC dependency, for example an injected service in controllers.
*/
protected static function mockIocDependency(string $abstract, ...$args): MockInterface
{
return tap(Mockery::mock($abstract, ...$args), static function (MockInterface $mocked) use ($abstract): void {
app()->instance($abstract, $mocked);
});
}
}