I'm trying to test a method of a class in my laravel project with mockery.
However, when I attempt to test the phpunit says a my interface class (which is being used in the method I need to test) is not instantiable.
What's wrong?
My test class
class HelperRSTest extends TestCase {
public function tearDown()
{
Mockery::close();
}
public function test_mockery()
{
// $mock = Mockery::mock('HelperRS');
// $mock->shouldReceive('getRecibosLocacao')->once()->andReturn('mocked');
$result = HelperRS::getRecibosLocacao(1228);
var_dump($result);
}
}
My target class to test
class HelperRS extends \BaseController {
public static function getRecibosLocacao($id_locacao){
$pagamentos = App::make('PagamentoRepositoryInterface');
$locacao = Locacao::find($id_locacao);
$pagamento = $pagamentos->getByVendaByTipo($locacao->cod_locacao, 'l');
dd($pagamento);
}
}
The error:
1) HelperRSTest::test_mockery
Illuminate\Container\BindingResolutionException: Target [PagamentoRepositoryInterface] is not instantiable.