Test open API service
php artisan make:test SampleTest
You can use above artisan command to make test command.
If you want to use repositories in Test file you have to follow below steps.
Step 1: Create setup function and add followings just like in constructors.
Step 2: use Collection.
use Illuminate\Support\Collection;
Step 3: Add repositories to setUp function
php artisan make:test SampleTest
You can use above artisan command to make test command.
If you want to use repositories in Test file you have to follow below steps.
Step 1: Create setup function and add followings just like in constructors.
public function setUp(){ parent::setUp(); $this->application = $this->app; $this->collection = new Collection(); }
Step 2: use Collection.
use Illuminate\Support\Collection;
Step 3: Add repositories to setUp function
public function setUp(){ parent::setUp(); $this->application = $this->app; $this->collection = new Collection(); $this->user_account = new AccountRepository($this->application, $this->collection); $this->role = new RoleRepository($this->application, $this->collection);}