From 2f84561c3eb44d957c5cc83dc4ae62a37a4e7b03 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 16 Mar 2024 15:42:14 +0100 Subject: [PATCH] use emoticons in generated names to check it supports utf8 chars --- CHANGELOG.md | 1 + fixtures/Name.php | 2 ++ tests/Adapter/FilesystemTest.php | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e6b347..6dd8329 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changed - Special ASCII characters are no longer used in genarated names via `Fixtures\Innmind\Filesystem\Name::any()` +- Emoticon characters are now used in genarated names via `Fixtures\Innmind\Filesystem\Name::any()` ## 7.4.0 - 2023-12-02 diff --git a/fixtures/Name.php b/fixtures/Name.php index b8869c9..a2f9e88 100644 --- a/fixtures/Name.php +++ b/fixtures/Name.php @@ -27,8 +27,10 @@ public static function strings(): Set return Set\Strings::madeOf( Set\Integers::between(32, 46)->map(\chr(...)), Set\Integers::between(48, 126)->map(\chr(...)), + Set\Unicode::emoticons(), ) ->between(1, 255) + ->filter(static fn($name) => \mb_strlen($name, 'ASCII') <= 255) ->filter( static fn(string $name): bool => $name !== '.' && $name !== '..' && diff --git a/tests/Adapter/FilesystemTest.php b/tests/Adapter/FilesystemTest.php index 9f42f9a..eb81376 100644 --- a/tests/Adapter/FilesystemTest.php +++ b/tests/Adapter/FilesystemTest.php @@ -437,7 +437,8 @@ public function testDotFilesAreListed() $name = ".$name"; $path = \sys_get_temp_dir().'/innmind/filesystem/'; (new FS)->remove($path); - (new FS)->dumpFile($path.$name, 'bar'); + (new FS)->mkdir($path); + \file_put_contents($path.$name, 'bar'); $filesystem = Filesystem::mount(Path::of($path));