Skip to content

Commit

Permalink
[10.x] league/flysystem 3.22.0 now prefer inclusive mime-type inste…
Browse files Browse the repository at this point in the history
…ad of `null`. (#49229)

* [10.x] Test Improvements

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

* wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

* Apply fixes from StyleCI

* wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

---------

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
  • Loading branch information
crynobone and StyleCIBot authored Dec 4, 2023
1 parent c59ef1f commit 0947618
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/Filesystem/FilesystemAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Tests\Filesystem;

use Carbon\Carbon;
use Composer\InstalledVersions;
use GuzzleHttp\Psr7\Stream;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Filesystem\FilesystemManager;
Expand Down Expand Up @@ -198,9 +199,19 @@ public function testJsonReturnsNullIfJsonDataIsInvalid()
$this->assertNull($filesystemAdapter->json('file.json'));
}

public function testMimeTypeNotDetected()
public function testMimeTypeDetectedPreferInclusiveMimeTypeOverNullAsEmpty()
{
if (version_compare(InstalledVersions::getPrettyVersion('league/flysystem'), '3.22.0', '<')) {
$this->markTestSkipped('Require league/flysystem 3.22.0');
}

$this->filesystem->write('unknown.mime-type', '');
$filesystemAdapter = new FilesystemAdapter($this->filesystem, $this->adapter);
$this->assertSame('application/x-empty', $filesystemAdapter->mimeType('unknown.mime-type'));
}

public function testMimeTypeNotDetected()
{
$filesystemAdapter = new FilesystemAdapter($this->filesystem, $this->adapter);
$this->assertFalse($filesystemAdapter->mimeType('unknown.mime-type'));
}
Expand Down Expand Up @@ -531,8 +542,6 @@ public function testThrowExceptionsForPut()

public function testThrowExceptionsForMimeType()
{
$this->filesystem->write('unknown.mime-type', '');

$adapter = new FilesystemAdapter($this->filesystem, $this->adapter, ['throw' => true]);

try {
Expand Down

0 comments on commit 0947618

Please sign in to comment.