@@ -62,6 +62,57 @@ public function testGetLineReturnsLine(): void
6262 $ this ->assertSame ('We saved some more ' , $ this ->lang ->getLine ('books.booksSaved ' ));
6363 }
6464
65+ public function testGetLineReturnsLineWithKeyWithDots (): void
66+ {
67+ $ this ->lang ->setData ('books ' , [
68+ 'bookSaved.foo ' => 'We kept the book free from the boogeyman ' ,
69+ 'booksSaved.bar.baz ' => 'We saved some more ' ,
70+ ]);
71+
72+ $ this ->assertSame (
73+ 'We kept the book free from the boogeyman ' ,
74+ $ this ->lang ->getLine ('books.bookSaved.foo ' )
75+ );
76+ $ this ->assertSame (
77+ 'We saved some more ' ,
78+ $ this ->lang ->getLine ('books.booksSaved.bar.baz ' )
79+ );
80+ }
81+
82+ public function testGetLineCannotUseKeysWithLeadingDot (): void
83+ {
84+ $ this ->lang ->setData ('books ' , [
85+ '.bookSaved.foo. ' => 'We kept the book free from the boogeyman ' ,
86+ '.booksSaved.bar.baz. ' => 'We saved some more ' ,
87+ ]);
88+
89+ $ this ->assertSame (
90+ 'books.bookSaved.foo ' , // Can't get the message.
91+ $ this ->lang ->getLine ('books.bookSaved.foo ' )
92+ );
93+ $ this ->assertSame (
94+ 'books.booksSaved.bar.baz ' , // Can't get the message.
95+ $ this ->lang ->getLine ('books.booksSaved.bar.baz ' )
96+ );
97+ }
98+
99+ public function testGetLineCannotUseKeysWithTrailingDot (): void
100+ {
101+ $ this ->lang ->setData ('books ' , [
102+ 'bookSaved.foo. ' => 'We kept the book free from the boogeyman ' ,
103+ 'booksSaved.bar.baz. ' => 'We saved some more ' ,
104+ ]);
105+
106+ $ this ->assertSame (
107+ 'books.bookSaved.foo ' , // Can't get the message.
108+ $ this ->lang ->getLine ('books.bookSaved.foo ' )
109+ );
110+ $ this ->assertSame (
111+ 'books.booksSaved.bar.baz ' , // Can't get the message.
112+ $ this ->lang ->getLine ('books.booksSaved.bar.baz ' )
113+ );
114+ }
115+
65116 public function testGetLineReturnsFallbackLine (): void
66117 {
67118 $ this ->lang
0 commit comments