I replaced
$this->attributes = Factory::party(['id' => 1, 'name' => 'MyParty name - test']);
```
with
$this->attributes = Factory::create('SebSept\PokerEventRegistry\Models\Party',['id' => 1, 'name' => 'MyParty name - test']);
Now I have the error
There was 1 error:
This is because data are inserted in database ...
So mocking fails ...
Ok, I was tired, read the doc then found https://github.com/JeffreyWay/Laravel-Test-Helpers/blob/master... this code must use Factory::make() Factory::create() uses the database.
This is ok :
public function setUp()
{
parent::setUp();
$this->mock = m::mock('Eloquent', 'SebSept\PokerEventRegistry\Models\Party');
$this->collection = m::mock('Illuminate\Database\Eloquent\Collection')->shouldDeferMissing();
$this->attributes = Factory::make('SebSept\PokerEventRegistry\Models\Party',['id' => 1, 'name' => 'MyParty name - test']);
$this->app->instance('SebSept\PokerEventRegistry\Models\Party', $this->mock);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community