Skip to content

Commit

Permalink
update: media directory structure tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FarhanShares committed Mar 17, 2021
1 parent 109488d commit da30dc9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/MediaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@

class MediaTest extends TestCase
{
public function getMediaPath($mediaId): string
{
return $mediaId . '-' . md5($mediaId . config('app.key'));
}


/** @test */
public function it_can_create_a_media_record_with_media_uploader()
{
Expand Down Expand Up @@ -107,7 +113,8 @@ public function it_can_get_the_path_on_disk_to_the_file()
$media->id = 1;
$media->file_name = 'image.jpg';

$this->assertEquals('1/image.jpg', $media->getPath());
$path = $this->getMediaPath($media->id);
$this->assertEquals($path . '/image.jpg', $media->getPath());
}

/** @test */
Expand All @@ -117,8 +124,9 @@ public function it_can_get_the_path_on_disk_to_a_converted_image()
$media->id = 1;
$media->file_name = 'image.jpg';

$path = $this->getMediaPath($media->id);
$this->assertEquals(
'1/conversions/thumbnail/image.jpg',
$path . '/conversions/thumbnail/image.jpg',
$media->getPath('thumbnail')
);
}
Expand Down

0 comments on commit da30dc9

Please sign in to comment.