mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-27 02:44:57 +00:00
34 lines
922 B
PHP
34 lines
922 B
PHP
<?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);
|
|
|
|
}
|
|
}
|