File tree Expand file tree Collapse file tree 4 files changed +78
-0
lines changed Expand file tree Collapse file tree 4 files changed +78
-0
lines changed Original file line number Diff line number Diff line change 7
7
class LanguageRoutesTest extends TestCase
8
8
{
9
9
protected $ app ;
10
+ public const FIXTURES = __DIR__ . '/fixtures ' ;
10
11
11
12
public function setUp (): void
12
13
{
@@ -67,6 +68,52 @@ public function testFallback()
67
68
$ this ->assertSame ($ app ->language ()->code (), 'en ' );
68
69
}
69
70
71
+ public static function languagePrefixProvider (): array {
72
+ return [
73
+ ['not-exists ' , 'Erreur ' ],
74
+ ['en/not-exists ' , 'Error ' ]
75
+ ];
76
+ }
77
+
78
+ /**
79
+ * @dataProvider languagePrefixProvider
80
+ */
81
+ public function testLanguagePrefix ($ path , $ body )
82
+ {
83
+ $ app = new App ([
84
+ 'roots ' => [
85
+ 'index ' => static ::FIXTURES ,
86
+ 'languages ' => static ::FIXTURES . '/languages ' ,
87
+ 'templates ' => static ::FIXTURES . '/templates '
88
+ ],
89
+ 'site ' => [
90
+ 'children ' => [
91
+ [
92
+ 'slug ' => 'error ' ,
93
+ 'template ' => 'error ' ,
94
+ 'translations ' => [
95
+ [
96
+ 'code ' => 'fr ' ,
97
+ 'content ' => [
98
+ 'title ' => 'Erreur '
99
+ ]
100
+ ],
101
+ [
102
+ 'code ' => 'en ' ,
103
+ 'content ' => [
104
+ 'title ' => 'Error '
105
+ ]
106
+ ]
107
+ ]
108
+ ]
109
+ ]
110
+ ]
111
+ ]);
112
+
113
+
114
+ $ this ->assertSame ($ body , $ app ->render ($ path )->body ());
115
+ }
116
+
70
117
public function testNotNextWhenFalsyReturn ()
71
118
{
72
119
$ a = $ b = $ c = $ d = $ e = 0 ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ return [
4
+ 'code ' => 'en ' ,
5
+ 'default ' => false ,
6
+ 'direction ' => 'ltr ' ,
7
+ 'locale ' => [
8
+ 'LC_ALL ' => 'en_US '
9
+ ],
10
+ 'name ' => 'English ' ,
11
+ 'translations ' => [
12
+
13
+ ],
14
+ 'url ' => NULL
15
+ ];
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ return [
4
+ 'code ' => 'fr ' ,
5
+ 'default ' => true ,
6
+ 'direction ' => 'ltr ' ,
7
+ 'locale ' => [
8
+ 'LC_ALL ' => 'fr_FR '
9
+ ],
10
+ 'name ' => 'French ' ,
11
+ 'translations ' => [
12
+
13
+ ],
14
+ 'url ' => '/ '
15
+ ];
Original file line number Diff line number Diff line change
1
+ <?= $ page ->title ();
You can’t perform that action at this time.
0 commit comments