@@ -16,21 +16,12 @@ class StageFrontTest extends TestCase
1616 */
1717 protected $ url ;
1818
19- public function setUp ()
19+ /** @test */
20+ public function it_redirects_to_a_login_screen_when_stagefront_is_enabled ()
2021 {
21- parent ::setUp ();
22-
23- // Note that changing the URL or middleware config in the tests
24- // has no effect until you call $this->enableStageFront().
25- // It is disabled by default so nothing is loaded by default.
2622 $ this ->url = config ('stagefront.url ' );
27-
2823 $ this ->registerRoute ('/page ' , 'Some Page ' );
29- }
3024
31- /** @test */
32- public function it_redirects_to_a_login_screen_when_stagefront_is_enabled ()
33- {
3425 $ this ->enableStageFront ();
3526
3627 $ this ->get ('/page ' )->assertRedirect ($ this ->url );
@@ -39,18 +30,27 @@ public function it_redirects_to_a_login_screen_when_stagefront_is_enabled()
3930 /** @test */
4031 public function it_does_not_redirect_to_a_login_screen_when_stagefront_is_disabled ()
4132 {
33+ $ this ->url = config ('stagefront.url ' );
34+ $ this ->registerRoute ('/page ' , 'Some Page ' );
35+
4236 $ this ->get ('/page ' )->assertStatus (200 )->assertSee ('Some Page ' );
4337 }
4438
4539 /** @test */
4640 public function the_login_route_does_not_exist_when_stagefront_is_disabled ()
4741 {
42+ $ this ->url = config ('stagefront.url ' );
43+ $ this ->registerRoute ('/page ' , 'Some Page ' );
44+
4845 $ this ->get ($ this ->url )->assertStatus (404 );
4946 }
5047
5148 /** @test */
5249 public function it_redirects_to_the_intended_url_when_you_provide_valid_credentials ()
5350 {
51+ $ this ->url = config ('stagefront.url ' );
52+ $ this ->registerRoute ('/page ' , 'Some Page ' );
53+
5454 config ()->set ('stagefront.login ' , 'tester ' );
5555 config ()->set ('stagefront.password ' , 'p4ssw0rd ' );
5656
@@ -68,6 +68,9 @@ public function it_redirects_to_the_intended_url_when_you_provide_valid_credenti
6868 /** @test */
6969 public function it_does_not_allow_access_when_you_provide_invalid_credentials ()
7070 {
71+ $ this ->url = config ('stagefront.url ' );
72+ $ this ->registerRoute ('/page ' , 'Some Page ' );
73+
7174 config ()->set ('stagefront.login ' , 'tester ' );
7275 config ()->set ('stagefront.password ' , 'p4ssw0rd ' );
7376
@@ -86,6 +89,9 @@ public function it_does_not_allow_access_when_you_provide_invalid_credentials()
8689 /** @test */
8790 public function it_redirects_home_if_you_are_already_logged_in ()
8891 {
92+ $ this ->url = config ('stagefront.url ' );
93+ $ this ->registerRoute ('/page ' , 'Some Page ' );
94+
8995 $ this ->enableStageFront ();
9096
9197 session ()->put ('stagefront.unlocked ' , true );
@@ -96,6 +102,9 @@ public function it_redirects_home_if_you_are_already_logged_in()
96102 /** @test */
97103 public function the_password_may_be_stored_encrypted ()
98104 {
105+ $ this ->url = config ('stagefront.url ' );
106+ $ this ->registerRoute ('/page ' , 'Some Page ' );
107+
99108 config ()->set ('stagefront.login ' , 'tester ' );
100109 config ()->set ('stagefront.password ' , bcrypt ('p4ssw0rd ' ));
101110 config ()->set ('stagefront.encrypted ' , true );
@@ -114,6 +123,9 @@ public function the_password_may_be_stored_encrypted()
114123 /** @test */
115124 public function the_users_in_the_database_can_be_used_for_logging_in ()
116125 {
126+ $ this ->url = config ('stagefront.url ' );
127+ $ this ->registerRoute ('/page ' , 'Some Page ' );
128+
117129 $ this ->loadLaravelMigrations (['--database ' => 'testing ' ]);
118130
119131 User::create ([
@@ -141,6 +153,9 @@ public function the_users_in_the_database_can_be_used_for_logging_in()
141153 /** @test */
142154 public function you_can_limit_which_database_users_have_access_using_a_comma_separated_string ()
143155 {
156+ $ this ->url = config ('stagefront.url ' );
157+ $ this ->registerRoute ('/page ' , 'Some Page ' );
158+
144159 $ this ->loadLaravelMigrations (['--database ' => 'testing ' ]);
145160
146161 User::create ([
@@ -186,6 +201,9 @@ public function you_can_limit_which_database_users_have_access_using_a_comma_sep
186201 /** @test */
187202 public function you_can_limit_which_database_users_have_access_using_an_array ()
188203 {
204+ $ this ->url = config ('stagefront.url ' );
205+ $ this ->registerRoute ('/page ' , 'Some Page ' );
206+
189207 $ this ->loadLaravelMigrations (['--database ' => 'testing ' ]);
190208
191209 User::create ([
@@ -231,6 +249,9 @@ public function you_can_limit_which_database_users_have_access_using_an_array()
231249 /** @test */
232250 public function urls_can_be_ignored_so_access_is_not_denied_by_stagefront ()
233251 {
252+ $ this ->url = config ('stagefront.url ' );
253+ $ this ->registerRoute ('/page ' , 'Some Page ' );
254+
234255 $ this ->registerRoute ('/public ' , 'Public ' );
235256 $ this ->registerRoute ('/public/route ' , 'Route ' );
236257
@@ -245,6 +266,9 @@ public function urls_can_be_ignored_so_access_is_not_denied_by_stagefront()
245266 /** @test */
246267 public function it_throttles_login_attempts ()
247268 {
269+ $ this ->url = config ('stagefront.url ' );
270+ $ this ->registerRoute ('/page ' , 'Some Page ' );
271+
248272 $ faultyCredentials = [
249273 'login ' => 'tester ' ,
250274 'password ' => 'invalid ' ,
@@ -264,6 +288,9 @@ public function it_throttles_login_attempts()
264288 /** @test */
265289 public function throttling_login_attempts_can_be_disabled ()
266290 {
291+ $ this ->url = config ('stagefront.url ' );
292+ $ this ->registerRoute ('/page ' , 'Some Page ' );
293+
267294 $ faultyCredentials = [
268295 'login ' => 'tester ' ,
269296 'password ' => 'invalid ' ,
0 commit comments