diff --git a/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php b/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php index fc3c3c4..3409c5e 100644 --- a/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php @@ -49,9 +49,7 @@ public function providerTestMimeHeader() { * @covers ::strtolower * @covers ::caseFlip */ - public function testStrtolower($text, $expected, $multibyte = FALSE) { - $status = $multibyte ? Unicode::STATUS_MULTIBYTE : Unicode::STATUS_SINGLEBYTE; - Unicode::setStatus($status); + public function testStrtolower($text, $expected) { $this->assertEquals($expected, Unicode::strtolower($text)); } @@ -61,22 +59,14 @@ public function testStrtolower($text, $expected, $multibyte = FALSE) { * @see testStrtolower() * * @return array - * An array containing a string, its lowercase version and whether it should - * be processed as multibyte. + * An array containing a string and its lowercase version. */ public function providerStrtolower() { - $cases = array( + return array( array('tHe QUIcK bRoWn', 'the quick brown'), array('FrançAIS is ÜBER-åwesome', 'français is über-åwesome'), + array('ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΣὨ', 'αβγδεζηθικλμνξοσὠ', TRUE), ); - foreach ($cases as $case) { - // Test the same string both in multibyte and singlebyte conditions. - array_push($case, TRUE); - $cases[] = $case; - } - // Add a multibyte string. - $cases[] = array('ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΣὨ', 'αβγδεζηθικλμνξοσὠ', TRUE); - return $cases; } /** @@ -86,9 +76,7 @@ public function providerStrtolower() { * @covers ::strtoupper * @covers ::caseFlip */ - public function testStrtoupper($text, $expected, $multibyte = FALSE) { - $status = $multibyte ? Unicode::STATUS_MULTIBYTE : Unicode::STATUS_SINGLEBYTE; - Unicode::setStatus($status); + public function testStrtoupper($text, $expected) { $this->assertEquals($expected, Unicode::strtoupper($text)); } @@ -98,22 +86,14 @@ public function testStrtoupper($text, $expected, $multibyte = FALSE) { * @see testStrtoupper() * * @return array - * An array containing a string, its uppercase version and whether it should - * be processed as multibyte. + * An array containing a string and its uppercase version. */ public function providerStrtoupper() { - $cases = array( + return array( array('tHe QUIcK bRoWn', 'THE QUICK BROWN'), array('FrançAIS is ÜBER-åwesome', 'FRANÇAIS IS ÜBER-ÅWESOME'), + array('αβγδεζηθικλμνξοσὠ', 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΣὨ'), ); - foreach ($cases as $case) { - // Test the same string both in multibyte and singlebyte conditions. - array_push($case, TRUE); - $cases[] = $case; - } - // Add a multibyte string. - $cases[] = array('αβγδεζηθικλμνξοσὠ', 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΣὨ', TRUE); - return $cases; } /** @@ -151,9 +131,7 @@ public function providerUcfirst() { * @dataProvider providerLcfirst * @covers ::lcfirst */ - public function testLcfirst($text, $expected, $multibyte = FALSE) { - $status = $multibyte ? Unicode::STATUS_MULTIBYTE : Unicode::STATUS_SINGLEBYTE; - Unicode::setStatus($status); + public function testLcfirst($text, $expected) { $this->assertEquals($expected, Unicode::lcfirst($text)); } @@ -163,8 +141,7 @@ public function testLcfirst($text, $expected, $multibyte = FALSE) { * @see testLcfirst() * * @return array - * An array containing a string, its lowercase version and whether it should - * be processed as multibyte. + * An array containing a string and its lowercase version. */ public function providerLcfirst() { return array( @@ -173,7 +150,7 @@ public function providerLcfirst() { array('Über', 'über'), array('Åwesome', 'åwesome'), // Add a multibyte string. - array('ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΣὨ', 'αΒΓΔΕΖΗΘΙΚΛΜΝΞΟΣὨ', TRUE), + array('ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΣὨ', 'αΒΓΔΕΖΗΘΙΚΛΜΝΞΟΣὨ'), ); } @@ -184,8 +161,6 @@ public function providerLcfirst() { * @covers ::ucwords */ public function testUcwords($text, $expected, $multibyte = FALSE) { - $status = $multibyte ? Unicode::STATUS_MULTIBYTE : Unicode::STATUS_SINGLEBYTE; - Unicode::setStatus($status); $this->assertEquals($expected, Unicode::ucwords($text)); } @@ -195,8 +170,7 @@ public function testUcwords($text, $expected, $multibyte = FALSE) { * @see testUcwords() * * @return array - * An array containing a string, its capitalized version and whether it should - * be processed as multibyte. + * An array containing a string and its capitalized version. */ public function providerUcwords() { return array( @@ -207,7 +181,7 @@ public function providerUcwords() { // Make sure we don't mangle extra spaces. array('frànçAIS is über-åwesome', 'FrànçAIS Is Über-Åwesome'), // Add a multibyte string. - array('σion', 'Σion', TRUE), + array('σion', 'Σion'), ); } @@ -218,11 +192,6 @@ public function providerUcwords() { * @covers ::strlen */ public function testStrlen($text, $expected) { - // Run through multibyte code path. - Unicode::setStatus(Unicode::STATUS_MULTIBYTE); - $this->assertEquals($expected, Unicode::strlen($text)); - // Run through singlebyte code path. - Unicode::setStatus(Unicode::STATUS_SINGLEBYTE); $this->assertEquals($expected, Unicode::strlen($text)); } @@ -249,11 +218,6 @@ public function providerStrlen() { * @covers ::substr */ public function testSubstr($text, $start, $length, $expected) { - // Run through multibyte code path. - Unicode::setStatus(Unicode::STATUS_MULTIBYTE); - $this->assertEquals($expected, Unicode::substr($text, $start, $length)); - // Run through singlebyte code path. - Unicode::setStatus(Unicode::STATUS_SINGLEBYTE); $this->assertEquals($expected, Unicode::substr($text, $start, $length)); } @@ -484,11 +448,6 @@ public function providerTestConvertToUtf8() { * @covers ::strpos */ public function testStrpos($haystack, $needle, $offset, $expected) { - // Run through multibyte code path. - Unicode::setStatus(Unicode::STATUS_MULTIBYTE); - $this->assertEquals($expected, Unicode::strpos($haystack, $needle, $offset)); - // Run through singlebyte code path. - Unicode::setStatus(Unicode::STATUS_SINGLEBYTE); $this->assertEquals($expected, Unicode::strpos($haystack, $needle, $offset)); }