diff --git a/packages/framework/tests/Unit/DataCollectionUnitTest.php b/packages/framework/tests/Unit/DataCollectionUnitTest.php index 016dd5adc24..3a78022ee93 100644 --- a/packages/framework/tests/Unit/DataCollectionUnitTest.php +++ b/packages/framework/tests/Unit/DataCollectionUnitTest.php @@ -123,6 +123,17 @@ public static function mockFiles(array $files): void assert(str_contains($file, '.'), 'File must have an extension.'); } + $filesystem = Mockery::mock(Filesystem::class); + $filesystem->shouldReceive('get') + ->andReturnUsing(function (string $file) use ($files) { + $file = unslash(str_replace(Hyde::path(), '', $file)); + $files = static::arrayGlob($files, $file, 'md'); + + return array_values($files)[0] ?? ''; + }); + + app()->instance(Filesystem::class, $filesystem); + static::$mockFiles = $files; }