-
-
Notifications
You must be signed in to change notification settings - Fork 78
/
Copy pathTestCase.php
50 lines (39 loc) · 1.67 KB
/
TestCase.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace Coderflex\LaravelTicket\Tests;
use Coderflex\LaravelTicket\LaravelTicketServiceProvider;
use Illuminate\Database\Eloquent\Factories\Factory;
use Orchestra\Testbench\TestCase as Orchestra;
class TestCase extends Orchestra
{
protected function setUp(): void
{
parent::setUp();
config()->set('app.key', '6rE9Nz59bGRbeMATftriyQjrpF7DcOQm');
Factory::guessFactoryNamesUsing(
fn (string $modelName) => 'Coderflex\\LaravelTicket\\Tests\\Database\\Factories\\'.class_basename($modelName).'Factory'
);
}
protected function getPackageProviders($app)
{
return [
LaravelTicketServiceProvider::class,
];
}
public function getEnvironmentSetUp($app)
{
config()->set('database.default', 'testing');
$migrations = [
include __DIR__.'/../database/migrations/create_tickets_table.php.stub',
include __DIR__.'/../database/migrations/create_categories_table.php.stub',
include __DIR__.'/../database/migrations/create_messages_table.php.stub',
include __DIR__.'/../database/migrations/create_labels_table.php.stub',
include __DIR__.'/../database/migrations/add_assigned_to_column_into_tickets_table.php.stub',
// Many to Many tables
include __DIR__.'/../database/migrations/create_label_ticket_table.php.stub',
include __DIR__.'/../database/migrations/create_category_ticket_table.php.stub',
// Tests Migration
include __DIR__.'/Database/Migrations/create_users_table.php',
];
collect($migrations)->each(fn ($migration) => $migration->up());
}
}