1414use PHPUnit \Framework \TestCase ;
1515
1616/**
17+ * @requires PHP 7.0
18+ *
1719 * @author Ion Bazan <[email protected] > 20+ * @author Nico Oelgart <[email protected] > 1821 */
1922class Php80Test extends TestCase
2023{
2124 /**
22- * @requires PHP 7.0
2325 * @covers \Symfony\Polyfill\Php80\Php80::fdiv
2426 * @dataProvider fdivProvider
2527 */
@@ -32,7 +34,6 @@ public function testFdiv($expected, $divident, $divisor)
3234 }
3335
3436 /**
35- * @requires PHP 7.0
3637 * @covers \Symfony\Polyfill\Php80\Php80::fdiv
3738 * @dataProvider nanFdivProvider
3839 */
@@ -42,7 +43,6 @@ public function testFdivNan($divident, $divisor)
4243 }
4344
4445 /**
45- * @requires PHP 7.0
4646 * @covers \Symfony\Polyfill\Php80\Php80::fdiv
4747 * @dataProvider invalidFloatProvider
4848 */
@@ -53,14 +53,42 @@ public function testFdivTypeError($divident, $divisor)
5353 }
5454
5555 /**
56- * @requires PHP 7.0
5756 */
5857 public function testFilterValidateBool ()
5958 {
6059 $ this ->assertTrue (\defined ('FILTER_VALIDATE_BOOL ' ));
6160 $ this ->assertSame (FILTER_VALIDATE_BOOLEAN , FILTER_VALIDATE_BOOL );
6261 }
6362
63+ /**
64+ * @covers \Symfony\Polyfill\Php80\Php80::pregLastErrorMsg
65+ */
66+ public function testPregNoError ()
67+ {
68+ $ this ->assertSame ('No error ' , preg_last_error_msg ());
69+ }
70+
71+ /**
72+ * @covers \Symfony\Polyfill\Php80\Php80::pregLastErrorMsg
73+ */
74+ public function testPregMalformedUtfError ()
75+ {
76+ @preg_split ('/a/u ' , "a \xff" );
77+ $ this ->assertSame ('Malformed UTF-8 characters, possibly incorrectly encoded ' , preg_last_error_msg ());
78+ }
79+
80+ /**
81+ * @covers \Symfony\Polyfill\Php80\Php80::pregLastErrorMsg
82+ */
83+ public function testPregMalformedUtf8Offset ()
84+ {
85+ @preg_match ('/a/u ' , "\xE3\x82\xA2" , $ m , 0 , 1 );
86+ $ this ->assertSame (
87+ 'The offset did not correspond to the beginning of a valid UTF-8 code point ' ,
88+ preg_last_error_msg ()
89+ );
90+ }
91+
6492 public function fdivProvider ()
6593 {
6694 return array (
0 commit comments