5
5
use App \Actions \Jetstream \AddTeamMember ;
6
6
use App \Actions \Jetstream \CreateTeam ;
7
7
use App \Models \Team ;
8
+ use Illuminate \Foundation \Testing \RefreshDatabase ;
8
9
use Illuminate \Support \Facades \Gate ;
9
10
use Illuminate \Validation \ValidationException ;
10
11
use Laravel \Jetstream \Jetstream ;
15
16
16
17
class AddTeamMemberTest extends OrchestraTestCase
17
18
{
18
- public function setUp (): void
19
+ use RefreshDatabase;
20
+
21
+ protected function defineEnvironment ($ app )
19
22
{
20
- parent ::setUp ( );
23
+ parent ::defineEnvironment ( $ app );
21
24
22
25
Gate::policy (Team::class, TeamPolicy::class);
23
26
@@ -28,8 +31,6 @@ public function test_team_members_can_be_added()
28
31
{
29
32
Jetstream::role ('admin ' , 'Admin ' , ['foo ' ]);
30
33
31
- $ this ->migrate ();
32
-
33
34
$ team = $ this ->createTeam ();
34
35
35
36
$ otherUser = User::forceCreate ([
@@ -62,8 +63,6 @@ public function test_user_email_address_must_exist()
62
63
{
63
64
$ this ->expectException (ValidationException::class);
64
65
65
- $ this ->migrate ();
66
-
67
66
$ team = $ this ->createTeam ();
68
67
69
68
$ action = new AddTeamMember ;
@@ -77,8 +76,6 @@ public function test_user_cant_already_be_on_team()
77
76
{
78
77
$ this ->expectException (ValidationException::class);
79
78
80
- $ this ->migrate ();
81
-
82
79
$ team = $ this ->createTeam ();
83
80
84
81
$ otherUser = User::forceCreate ([
@@ -106,9 +103,4 @@ protected function createTeam()
106
103
107
104
return $ action ->create ($ user , ['name ' => 'Test Team ' ]);
108
105
}
109
-
110
- protected function migrate ()
111
- {
112
- $ this ->artisan ('migrate ' , ['--database ' => 'testbench ' ])->run ();
113
- }
114
106
}
0 commit comments