-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
isAllowedMimeType can actually check for multiple in one go. Update s…
…ignature to allow for array params. Also tests.
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Javaabu\Helpers\Tests\Feature; | ||
|
||
use Javaabu\Helpers\Media\AllowedMimeTypes; | ||
use Javaabu\Helpers\Tests\TestCase; | ||
|
||
class AllowedMimeTypesTest extends TestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_check_if_a_given_mime_type_as_a_string_is_an_allowed_mime_type(): void | ||
{ | ||
$result = AllowedMimeTypes::isAllowedMimeType('image/jpeg', 'image'); | ||
$this->assertTrue($result); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_check_if_a_given_mime_type_as_an_array_is_an_allowed_mime_type() | ||
{ | ||
$result = AllowedMimeTypes::isAllowedMimeType('image/jpeg', ['image', 'video']); | ||
$this->assertTrue($result); | ||
|
||
$result = AllowedMimeTypes::isAllowedMimeType('video/mp4', ['image', 'video']); | ||
$this->assertTrue($result); | ||
} | ||
|
||
} |