Skip to content

Commit 94e3f21

Browse files
committed
Clean up and improve the Claude generated unit test
1 parent eb0cb02 commit 94e3f21

File tree

1 file changed

+3
-33
lines changed

1 file changed

+3
-33
lines changed

packages/framework/tests/Unit/Foundation/FilesystemHasMediaFilesTest.php

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,6 @@ public function testAssetsMethodReturnsEmptyCollectionWhenNoMediaFiles()
4444
$this->assertTrue($assets->isEmpty());
4545
}
4646

47-
public function testAssetsMethodWithCustomMediaExtensions()
48-
{
49-
self::mockConfig(['hyde.media_extensions' => ['jpg', 'png']]);
50-
51-
$this->filesystem->setTestMediaFiles([
52-
Hyde::path('_media/image1.jpg'),
53-
Hyde::path('_media/image2.png'),
54-
Hyde::path('_media/document.pdf'), // This should be excluded
55-
]);
56-
57-
$assets = $this->filesystem->assets();
58-
59-
$this->assertCount(2, $assets);
60-
$this->assertTrue($assets->has('image1.jpg'));
61-
$this->assertTrue($assets->has('image2.png'));
62-
$this->assertFalse($assets->has('document.pdf'));
63-
}
64-
6547
public function testAssetsMethodWithNestedDirectories()
6648
{
6749
$this->filesystem->setTestMediaFiles([
@@ -76,27 +58,15 @@ public function testAssetsMethodWithNestedDirectories()
7658
$this->assertTrue($assets->has('documents/report.pdf'));
7759
}
7860

79-
public function testAssetsMethodWithInvalidMediaFile()
80-
{
81-
$this->filesystem->setTestMediaFiles([
82-
Hyde::path('_media/valid.jpg'),
83-
Hyde::path('_media/invalid'), // File without extension
84-
]);
85-
86-
$assets = $this->filesystem->assets();
87-
88-
$this->assertCount(1, $assets);
89-
$this->assertTrue($assets->has('valid.jpg'));
90-
$this->assertFalse($assets->has('invalid'));
91-
}
92-
9361
public function testGetMediaGlobPatternWithCustomMediaDirectory()
9462
{
95-
self::mockConfig(['hyde.media_directory' => 'custom_media']);
63+
Hyde::setMediaDirectory('custom_media');
9664

9765
$pattern = $this->filesystem->getTestMediaGlobPattern();
9866

9967
$this->assertStringContainsString('custom_media/', $pattern);
68+
69+
Hyde::setMediaDirectory('_media');
10070
}
10171

10272
public function testGetMediaGlobPatternWithCustomExtensions()

0 commit comments

Comments
 (0)