I am trying to set up the simplest tests in my controller, but like most of Laravel's other things, there are no decent tutorials to demonstrate simple things.
I can run a simple test (in the UserControllerTest file), for example:
public function testIndex()
{
$this->call('GET', 'users');
$this->assertViewHas('users');
}
This calls the / users route and passes it to the users of the array.
I want to do the same with Mockery, but how?
If I try this:
public function testIndex()
{
$this->mock->shouldReceive('users')->once();
$this->call('GET', 'users');
}
I get the error "Static method Mockery_0_users :: all does not exist in this breadboard object.
Why not? I am mocking a User who expands Rage and, in turn, expands Eloquence. Why :: everything does not exist for the layout?
By the way, these are the settings for Mockery:
public function setUp()
{
parent::setUp();
$this->mock = $this->mock('User');
}
public function mock($class)
{
$mock = Mockery::mock($class);
$this->app->instance($class, $mock);
return $mock;
}