5
5
use CodeZero \BrowserLocale \BrowserLocale ;
6
6
use CodeZero \LocalizedRoutes \LocalizedRoutesServiceProvider ;
7
7
use CodeZero \UriTranslator \UriTranslatorServiceProvider ;
8
+ use Illuminate \Config \Repository ;
9
+ use Illuminate \Contracts \Container \BindingResolutionException ;
10
+ use Illuminate \Contracts \Foundation \Application ;
8
11
use Illuminate \Contracts \View \View ;
9
12
use Illuminate \Support \Collection ;
10
13
use Illuminate \Support \Facades \App ;
17
20
use Orchestra \Testbench \TestCase as BaseTestCase ;
18
21
use PHPUnit \Framework \Assert ;
19
22
20
- abstract class TestCase extends BaseTestCase
23
+ abstract class TestCase extends BaseTestCase
21
24
{
22
- protected $ sessionKey ;
23
- protected $ cookieName ;
25
+ protected string $ sessionKey ;
26
+ protected string $ cookieName ;
24
27
25
28
/**
26
- * Setup the test environment.
29
+ * Set up the test environment.
27
30
*
28
31
* @return void
29
32
*/
30
33
protected function setUp (): void
31
34
{
32
35
parent ::setUp ();
33
36
34
- Config::set ('app.key ' , Str::random (32 ));
35
-
36
37
// Remove any default browser locales
37
38
$ this ->setBrowserLocales (null );
38
39
39
- $ this ->sessionKey = Config::get ('localized-routes.session_key ' );
40
- $ this ->cookieName = Config::get ('localized-routes.cookie_name ' );
40
+ $ this ->sessionKey = Config::string ('localized-routes.session_key ' );
41
+ $ this ->cookieName = Config::string ('localized-routes.cookie_name ' );
41
42
42
43
TestResponse::macro ('assertResponseHasNoView ' , function () {
43
44
if (isset ($ this ->original ) && $ this ->original instanceof View) {
@@ -48,6 +49,22 @@ protected function setUp(): void
48
49
});
49
50
}
50
51
52
+ /**
53
+ * Define the environment setup for the application.
54
+ *
55
+ * @param Application $app
56
+ *
57
+ * @return void
58
+ */
59
+ protected function defineEnvironment ($ app ): void
60
+ {
61
+ $ config = $ app ->make (Repository::class);
62
+ $ config ->set ([
63
+ 'app.key ' => Str::random (32 ),
64
+ 'filesystems.disks.local.serve ' => false ,
65
+ ]);
66
+ }
67
+
51
68
/**
52
69
* Skip test if laravel version is lower than the given version.
53
70
*
0 commit comments