Skip to content

Commit

Permalink
Merge branch 'hotfix/1.4.1' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/StingerSoft/ExcelCreator/Helper.php
#	tests/StingerSoft/ExcelCreator/HelperTest.php
  • Loading branch information
koddistortion committed Aug 26, 2020
2 parents 6e577c4 + 33dabff commit 584f674
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/StingerSoft/ExcelCreator/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use Symfony\Contracts\Translation\TranslatorInterface;
use function str_replace;
use function substr;
use function mb_substr;

/**
* Some helper methods
Expand Down Expand Up @@ -112,7 +112,7 @@ protected function setSheetTitle(Worksheet $sheet, string $title): void {
* @return bool|string
*/
protected function cleanSheetTitle(string $title) {
return substr(str_replace(Worksheet::getInvalidCharacters(), '_', $title), 0, 31);
return mb_substr(str_replace(Worksheet::getInvalidCharacters(), '_', $title), 0, 31);
}

protected static function getTemporaryFileNames(): array {
Expand Down
7 changes: 7 additions & 0 deletions tests/StingerSoft/ExcelCreator/HelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ public function testSetSheetTitle(): void {

$this->setSheetTitle($sheet, 'Test:::::');
self::assertEquals('Test_____', $sheet->getTitle());

$this->setSheetTitle($sheet, 'ワークショップオーダー');
self::assertEquals('ワークショップオーダー', $sheet->getTitle());

$this->setSheetTitle($sheet, 'ワークショップオーダaーワークショップオーダーaワークショップオーダaーワークショップオーダーa');
self::assertEquals('ワークショップオーダaーワークショップオーダーaワークショップ', $sheet->getTitle());

}

}

0 comments on commit 584f674

Please sign in to comment.