Files
shipping-portal/tests/TestCase.php
T
2025-04-14 15:20:40 +08:00

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();
}
}