File tree 2 files changed +47
-1
lines changed
2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public function __invoke()
10
10
{
11
11
session ()->reflash ();
12
12
13
- $ url = config ('statamic.cp.route ' ).'/ ' .urlencode ( Preference::get ('start_page ' , config ('statamic.cp.start_page ' ) ));
13
+ $ url = config ('statamic.cp.route ' ).'/ ' .Preference::get ('start_page ' , config ('statamic.cp.start_page ' ));
14
14
15
15
return redirect ($ url );
16
16
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace CP ;
4
+
5
+ use PHPUnit \Framework \Attributes \Test ;
6
+ use Statamic \Facades \File ;
7
+ use Statamic \Facades \Preference ;
8
+ use Statamic \Facades \User ;
9
+ use Tests \PreventSavingStacheItemsToDisk ;
10
+ use Tests \TestCase ;
11
+
12
+ class StartPageTest extends TestCase
13
+ {
14
+ use PreventSavingStacheItemsToDisk;
15
+
16
+ protected function setUp (): void
17
+ {
18
+ parent ::setUp ();
19
+
20
+ File::delete (resource_path ('preferences.yaml ' ));
21
+ }
22
+
23
+ #[Test]
24
+ public function it_uses_start_page_preference ()
25
+ {
26
+ config ('statamic.cp.start_page ' , 'dashboard ' );
27
+
28
+ Preference::default ()->setPreference ('start_page ' , 'collections/pages ' )->save ();
29
+
30
+ $ this
31
+ ->actingAs (User::make ()->makeSuper ()->save ())
32
+ ->get ('/cp ' )
33
+ ->assertRedirect ('/cp/collections/pages ' );
34
+ }
35
+
36
+ #[Test]
37
+ public function it_falls_back_to_start_page_config_option_when_preference_is_missing ()
38
+ {
39
+ config ('statamic.cp.start_page ' , 'dashboard ' );
40
+
41
+ $ this
42
+ ->actingAs (User::make ()->makeSuper ()->save ())
43
+ ->get ('/cp ' )
44
+ ->assertRedirect ('/cp/dashboard ' );
45
+ }
46
+ }
You can’t perform that action at this time.
0 commit comments