mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 11:14:06 +00:00
145 - Resizing the Poster Image
This commit is contained in:
33
tests/Unit/Jobs/ProcessPosterImageTest.php
Normal file
33
tests/Unit/Jobs/ProcessPosterImageTest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Jobs\ProcessPosterImage;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class ProcessPosterImageTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/** @test */
|
||||
function it_resizes_the_poster_image_to_600px_wide()
|
||||
{
|
||||
Storage::fake('public');
|
||||
Storage::disk('public')->put(
|
||||
'posters/example-poster.png',
|
||||
file_get_contents(base_path('tests/__fixtures__/full-size-poster.png'))
|
||||
);
|
||||
$concert = \ConcertFactory::createUnpublished([
|
||||
'poster_image_path' => 'posters/example-poster.png',
|
||||
]);
|
||||
|
||||
ProcessPosterImage::dispatch($concert);
|
||||
|
||||
$resizedImage = Storage::disk('public')->get('posters/example-poster.png');
|
||||
list($width) = getimagesizefromstring($resizedImage);
|
||||
$this->assertEquals(600, $width);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user