Files
paranarimasu ad07aa3703 #395 support images for studios (#403)
* feat: support images for studios

* style: fix StyleCI findings

* fix(admin): throw exception for image request

* style: fix StyleCI findings

* style: remove extraneous constant

* fix(admin): resources mapping may not exist when sending pipe notification

* style: fix StyleCI findings
2022-06-23 12:44:45 -05:00

54 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature\Events\Pivot;
use App\Events\Pivot\StudioImage\StudioImageCreated;
use App\Events\Pivot\StudioImage\StudioImageDeleted;
use App\Models\Wiki\Image;
use App\Models\Wiki\Studio;
use Illuminate\Support\Facades\Event;
use Tests\TestCase;
/**
* Class StudioImageTest.
*/
class StudioImageTest extends TestCase
{
/**
* When a Studio is attached to an Image or vice versa, a StudioImageCreated event shall be dispatched.
*
* @return void
*/
public function testStudioImageCreatedEventDispatched(): void
{
Event::fake();
$studio = Studio::factory()->createOne();
$image = Image::factory()->createOne();
$studio->images()->attach($image);
Event::assertDispatched(StudioImageCreated::class);
}
/**
* When a Studio is detached from an Image or vice versa, a StudioImageDeleted event shall be dispatched.
*
* @return void
*/
public function testStudioImageDeletedEventDispatched(): void
{
Event::fake();
$studio = Studio::factory()->createOne();
$image = Image::factory()->createOne();
$studio->images()->attach($image);
$studio->images()->detach($image);
Event::assertDispatched(StudioImageDeleted::class);
}
}