66use BladeUI \Icons \Factory ;
77use Code16 \ContentRenderer \ContentRendererServiceProvider ;
88use Code16 \Sharp \SharpInternalServiceProvider ;
9- use Illuminate \Testing \Fluent \AssertableJson ;
109use Orchestra \Testbench \Pest \WithPest ;
1110use Orchestra \Testbench \TestCase as Orchestra ;
12- use PHPUnit \Framework \Assert as PHPUnit ;
1311
1412class TestCase extends Orchestra
1513{
@@ -20,30 +18,9 @@ protected function setUp(): void
2018 parent ::setUp ();
2119
2220 $ this ->withoutVite ();
23-
24- config ()->set ('app.key ' , 'base64: ' .base64_encode (random_bytes (32 )));
25- config ()->set ('view.cache ' , false );
26- config ()->set ('inertia.testing.page_paths ' , [__DIR__ .'/../resources/js/Pages ' ]);
27-
28- // laravel 11 polyfill, TODO to remove when laravel 12+ only
29- AssertableJson::macro ('whereNull ' , function ($ key ) {
30- $ this ->has ($ key );
31-
32- $ actual = $ this ->prop ($ key );
33-
34- PHPUnit::assertNull (
35- $ actual ,
36- sprintf (
37- 'Property [%s] should be null. ' ,
38- $ this ->dotPath ($ key ),
39- )
40- );
41-
42- return $ this ;
43- });
4421 }
4522
46- protected function getPackageProviders ($ app )
23+ protected function getPackageProviders ($ app ): array
4724 {
4825 return [
4926 SharpInternalServiceProvider::class,
@@ -52,20 +29,18 @@ protected function getPackageProviders($app)
5229 ];
5330 }
5431
55- public function getEnvironmentSetUp ($ app )
32+ public function defineEnvironment ($ app ): void
5633 {
57- config ()->set ('database.default ' , 'testing ' );
34+ $ app ['config ' ]->set ('app.key ' , 'base64: ' .base64_encode (random_bytes (32 )));
35+ $ app ['config ' ]->set ('view.cache ' , false );
36+ $ app ['config ' ]->set ('inertia.testing.page_paths ' , [__DIR__ .'/../resources/js/Pages ' ]);
37+ $ app ['config ' ]->set ('database.default ' , 'testing ' );
38+
39+ $ app ['view ' ]->addNamespace ('fixtures ' , __DIR__ .'/Fixtures/resources/views ' );
5840
5941 $ app ->make (Factory::class)->add ('testicon ' , [
6042 'path ' => __DIR__ .'/Fixtures/resources/svg ' ,
6143 'prefix ' => 'testicon ' ,
6244 ]);
63-
64- $ app ->make ('view ' )->addNamespace ('fixtures ' , __DIR__ .'/Fixtures/resources/views ' );
65-
66- // We have to set these two because otherwise corresponding routes won't be loaded at all
67- sharp ()->config ()
68- ->enableForgottenPassword ()
69- ->enableImpersonation ();
7045 }
7146}
0 commit comments