mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-10-25 02:59:28 +01:00
50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Pivots\Wiki;
|
|
|
|
use App\Models\Wiki\Song;
|
|
use App\Models\Wiki\ExternalResource;
|
|
use App\Pivots\Wiki\SongResource;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Tests\TestCase;
|
|
|
|
/**
|
|
* Class SongResourceTest.
|
|
*/
|
|
class SongResourceTest extends TestCase
|
|
{
|
|
/**
|
|
* An SongResource shall belong to an Song.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testSong(): void
|
|
{
|
|
$songResource = SongResource::factory()
|
|
->for(Song::factory())
|
|
->for(ExternalResource::factory(), 'resource')
|
|
->createOne();
|
|
|
|
static::assertInstanceOf(BelongsTo::class, $songResource->song());
|
|
static::assertInstanceOf(Song::class, $songResource->song()->first());
|
|
}
|
|
|
|
/**
|
|
* An SongResource shall belong to an ExternalResource.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testResource(): void
|
|
{
|
|
$songResource = SongResource::factory()
|
|
->for(Song::factory())
|
|
->for(ExternalResource::factory(), 'resource')
|
|
->createOne();
|
|
|
|
static::assertInstanceOf(BelongsTo::class, $songResource->resource());
|
|
static::assertInstanceOf(ExternalResource::class, $songResource->resource()->first());
|
|
}
|
|
}
|