mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
54 lines
1012 B
PHP
54 lines
1012 B
PHP
<?php
|
|
|
|
namespace Tests;
|
|
|
|
use Faker\Factory as Faker;
|
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
use JWTAuth;
|
|
|
|
abstract class TestCase extends BaseTestCase
|
|
{
|
|
|
|
use CreatesApplication, RefreshDatabase, DatabaseMigrations;
|
|
|
|
protected $faker;
|
|
|
|
|
|
/* public function actingAs($user, $driver = "api"): TestCase
|
|
{
|
|
$token = JWTAuth::fromUser($user);
|
|
$this->withHeader('Authorization', "Bearer {$token}");
|
|
parent::actingAs($user);
|
|
|
|
return $this;
|
|
}*/
|
|
|
|
|
|
/**
|
|
* Sets up the tests
|
|
*/
|
|
public function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->faker = Faker::create();
|
|
|
|
Artisan::call('migrate');
|
|
}
|
|
|
|
|
|
/**
|
|
* Rolls back migrations
|
|
*/
|
|
public function tearDown(): void
|
|
{
|
|
Artisan::call('migrate:rollback');
|
|
|
|
parent::tearDown();
|
|
}
|
|
|
|
}
|