mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
ad07aa3703
* 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
53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Pivots;
|
|
|
|
use App\Models\Wiki\Image;
|
|
use App\Models\Wiki\Studio;
|
|
use App\Pivots\StudioImage;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Foundation\Testing\WithoutEvents;
|
|
use Tests\TestCase;
|
|
|
|
/**
|
|
* Class StudioImageTest.
|
|
*/
|
|
class StudioImageTest extends TestCase
|
|
{
|
|
use WithoutEvents;
|
|
|
|
/**
|
|
* An StudioImage shall belong to a Studio.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testStudio(): void
|
|
{
|
|
$studioImage = StudioImage::factory()
|
|
->for(Studio::factory())
|
|
->for(Image::factory())
|
|
->createOne();
|
|
|
|
static::assertInstanceOf(BelongsTo::class, $studioImage->studio());
|
|
static::assertInstanceOf(Studio::class, $studioImage->studio()->first());
|
|
}
|
|
|
|
/**
|
|
* An StudioImage shall belong to an Image.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testImage(): void
|
|
{
|
|
$studioImage = StudioImage::factory()
|
|
->for(Studio::factory())
|
|
->for(Image::factory())
|
|
->createOne();
|
|
|
|
static::assertInstanceOf(BelongsTo::class, $studioImage->image());
|
|
static::assertInstanceOf(Image::class, $studioImage->image()->first());
|
|
}
|
|
}
|