-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCase.php
More file actions
85 lines (70 loc) · 2.1 KB
/
Copy pathTestCase.php
File metadata and controls
85 lines (70 loc) · 2.1 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
declare(strict_types=1);
namespace Modules\Activity\Tests;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\ServiceProvider;
use Modules\Activity\Filament\Pages\ListLogActivities;
use Modules\Activity\Providers\ActivityServiceProvider;
use Modules\Activity\Providers\EventServiceProvider;
use Modules\User\Models\User;
use Modules\User\Providers\UserServiceProvider;
use Modules\Xot\Tests\XotBaseTestCase;
/**
* Base test case for Activity module.
*
* Uses shared shared_test_data.sqlite (no RefreshDatabase / migrate:fresh).
* prepareSharedProjectSqliteForTesting() runs before transactions begin.
*
* @property ListLogActivities|null $page
*/
abstract class TestCase extends XotBaseTestCase
{
use DatabaseTransactions;
public ?ListLogActivities $page = null;
/**
* Shared test data for Activity entity.
*
* @var array<string, mixed>
*/
public array $activityData = [];
/**
* Shared test data for stored event entity.
*
* @var array<string, mixed>
*/
public array $storedEventData = [];
/**
* Shared test data for snapshot entity.
*
* @var array<string, mixed>
*/
public array $snapshotData = [];
/** @var list<string> */
protected $connectionsToTransact = ['sqlite', 'activity', 'user'];
protected function setUp(): void
{
$this->prepareSharedProjectSqliteForTesting();
parent::setUp();
config(['auth.providers.users.model' => User::class]);
}
/**
* @return array<int, class-string<ServiceProvider>>
*/
protected function getPackageProviders(Application $app): array
{
return [
...parent::getPackageProviders($app),
UserServiceProvider::class,
ActivityServiceProvider::class,
EventServiceProvider::class,
];
}
public function requirePage(): ListLogActivities
{
if ($this->page === null) {
$this->fail('ListLogActivities page is not initialized.');
}
return $this->page;
}
}