@@ -153,6 +153,21 @@ public function assertElementContains_should_scope_matches_to_selector()
153153 );
154154 }
155155
156+ /**
157+ * @test
158+ * @testdox assertElementContains() should handle various character sets
159+ * @dataProvider provideGreetingsInDifferentLanguages
160+ * @ticket https://github.com/stevegrunwell/phpunit-markup-assertions/issues/31
161+ */
162+ public function assertElementContains_should_handle_various_character_sets ($ greeting )
163+ {
164+ $ this ->assertElementContains (
165+ $ greeting ,
166+ 'h1 ' ,
167+ sprintf ('<div><h1>%s</h1></div> ' , $ greeting )
168+ );
169+ }
170+
156171 /**
157172 * @test
158173 * @testdox assertElementNotContains() should be able to search for a selector
@@ -162,7 +177,22 @@ public function assertElementNotContains_can_match_a_selector()
162177 $ this ->assertElementNotContains (
163178 'ipsum ' ,
164179 '#main ' ,
165- '<header>Foo bar baz</header><div id="main">Some string</div> '
180+ '<div>Foo bar baz</div><div id="main">Some string</div> '
181+ );
182+ }
183+
184+ /**
185+ * @test
186+ * @testdox assertElementNotContains() should handle various character sets
187+ * @dataProvider provideGreetingsInDifferentLanguages
188+ * @ticket https://github.com/stevegrunwell/phpunit-markup-assertions/issues/31
189+ */
190+ public function assertElementNotContains_should_handle_various_character_sets ($ greeting )
191+ {
192+ $ this ->assertElementNotContains (
193+ $ greeting ,
194+ 'h1 ' ,
195+ sprintf ('<h1>Translation</h1><p>%s</p> ' , $ greeting )
166196 );
167197 }
168198
@@ -328,4 +358,23 @@ public function provideSelectorVariants()
328358 'Tag with href attribute ' => ['a[href="https://example.com"] ' ],
329359 ];
330360 }
361+
362+ /**
363+ * Provide a list of strings in various language.
364+ *
365+ * @return array<string,array<string>>
366+ */
367+ public function provideGreetingsInDifferentLanguages ()
368+ {
369+ return [
370+ 'Arabic ' => ['مرحبا! ' ],
371+ 'Chinese ' => ['你好 ' ],
372+ 'English ' => ['Hello ' ],
373+ 'Hebrew ' => ['שלום ' ],
374+ 'Japanese ' => ['こんにちは ' ],
375+ 'Korean ' => ['안녕하십니까 ' ],
376+ 'Punjabi ' => ['ਸਤ ਸ੍ਰੀ ਅਕਾਲ ' ],
377+ 'Ukrainian ' => ['Привіт ' ],
378+ ];
379+ }
331380}
0 commit comments