11<?php namespace GeneaLabs \LaravelGovernor \Tests ;
22
3- use Orchestra \Testbench \TestCase as BaseTestCase ;
4- use GeneaLabs \LaravelGovernor \Tests \Fixtures \User ;
53use GeneaLabs \LaravelGovernor \Database \Seeders \LaravelGovernorDatabaseSeeder ;
4+ use GeneaLabs \LaravelGovernor \Tests \Fixtures \User ;
5+ use Orchestra \Testbench \TestCase as BaseTestCase ;
6+ use PHPUnit \Framework \Attributes \Test ;
67
78class AlwaysRunFirstTest extends BaseTestCase
89{
@@ -18,54 +19,56 @@ protected function getPackageProviders($app)
1819
1920 protected function getEnvironmentSetUp ($ app )
2021 {
21- parent :: getEnvironmentSetUp ( $ app ) ;
22+ $ sqliteDatabase = __DIR__ . ' /database/database.sqlite ' ;
2223
23- shell_exec ("cd " . __DIR__ . "/database && rm *.sqlite && touch database.sqlite " );
24+ if (file_exists ($ sqliteDatabase )) {
25+ unlink ($ sqliteDatabase );
26+ }
27+ touch ($ sqliteDatabase );
2428
2529 $ app ['config ' ]->set ('genealabs-laravel-governor.models ' , [
26- 'auth ' => User::class,
27- 'action ' => \GeneaLabs \LaravelGovernor \Action::class,
30+ 'auth ' => User::class,
31+ 'action ' => \GeneaLabs \LaravelGovernor \Action::class,
2832 'assignment ' => \GeneaLabs \LaravelGovernor \Assignment::class,
29- 'entity ' => \GeneaLabs \LaravelGovernor \Entity::class,
30- 'group ' => \GeneaLabs \LaravelGovernor \Group::class,
31- 'ownership ' => \GeneaLabs \LaravelGovernor \Ownership::class,
33+ 'entity ' => \GeneaLabs \LaravelGovernor \Entity::class,
34+ 'group ' => \GeneaLabs \LaravelGovernor \Group::class,
35+ 'ownership ' => \GeneaLabs \LaravelGovernor \Ownership::class,
3236 'permission ' => \GeneaLabs \LaravelGovernor \Permission::class,
33- 'role ' => \GeneaLabs \LaravelGovernor \Role::class,
34- 'team ' => \GeneaLabs \LaravelGovernor \Team::class,
37+ 'role ' => \GeneaLabs \LaravelGovernor \Role::class,
38+ 'team ' => \GeneaLabs \LaravelGovernor \Team::class,
3539 'invitation ' => \GeneaLabs \LaravelGovernor \TeamInvitation::class,
3640 ]);
3741 $ app ['config ' ]->set ('database.default ' , 'sqlite ' );
3842 $ app ['config ' ]->set ('database.connections.sqlite ' , [
39- 'driver ' => 'sqlite ' ,
40- " url " => null ,
41- 'database ' => __DIR__ . ' /database/database.sqlite ' ,
42- 'prefix ' => '' ,
43- " foreign_key_constraints " => false ,
43+ 'driver ' => 'sqlite ' ,
44+ ' url ' => null ,
45+ 'database ' => $ sqliteDatabase ,
46+ 'prefix ' => '' ,
47+ ' foreign_key_constraints ' => false ,
4448 ]);
4549 }
4650
47- public function setUp () : void
51+ public function setUp (): void
4852 {
4953 parent ::setUp ();
5054
51- $ this ->loadLaravelMigrations ();
52- $ this ->loadMigrationsFrom (__DIR__ . "/../database/migrations " );
53- $ this ->loadMigrationsFrom (__DIR__ . "/database/migrations " );
55+ $ this ->loadMigrationsFrom (__DIR__ . '/database/migrations ' );
56+ $ this ->loadMigrationsFrom (__DIR__ . '/../database/migrations ' );
5457 $ this ->artisan ('migrate ' );
5558 $ this ->artisan ('db:seed ' , [
56- " --database " => " sqlite " ,
57- '--class ' => LaravelGovernorDatabaseSeeder::class,
59+ ' --database ' => ' sqlite ' ,
60+ '--class ' => LaravelGovernorDatabaseSeeder::class,
5861 '--no-interaction ' => true ,
5962 ]);
6063 }
6164
62- public function tearDown () : void
65+ public function tearDown (): void
6366 {
64- $ this -> app [ ' config ' ]-> set ( ' database.default ' , ' testing ' );
67+ parent :: tearDown ( );
6568 }
6669
67- /** @test */
68- public function migrateAndInstallTheDatabase ()
70+ #[Test]
71+ public function testMigrateAndInstallTheDatabase (): void
6972 {
7073 $ this ->assertTrue (true );
7174 }
0 commit comments