Skip to content

Commit

Permalink
Add test for PHPOffice#2868 Fix mb_substr with null to parameter depr…
Browse files Browse the repository at this point in the history
…ecation message (PHP 8.1)
  • Loading branch information
yblatti committed Jun 2, 2022
1 parent c619897 commit 7c6cab1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/PhpSpreadsheetTests/Shared/StringHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,21 @@ public function testSYLKtoUTF8(): void

self::assertEquals($expectedResult, $result);
}

public function testSubstringUTF8(): void
{
$expectedResult = '😀';
$result = StringHelper::substring('🙃😀🙃', 1, 1);

self::assertEquals($expectedResult, $result);
}

public function testSubstringWithNull(): void
{
// Issue #2868 PHP 8.1 Deprecation message for null value
$expectedResult = '';
$result = StringHelper::substring(null, 1, 10);

self::assertEquals($expectedResult, $result);
}
}

0 comments on commit 7c6cab1

Please sign in to comment.