2022-07-26 20:23:34 +00:00
|
|
|
<?php
|
|
|
|
|
2023-06-05 21:46:41 +00:00
|
|
|
namespace Tests\Feature;
|
2022-07-26 20:23:34 +00:00
|
|
|
|
|
|
|
use App\Models\Artist;
|
|
|
|
use App\Models\Song;
|
|
|
|
|
|
|
|
class ArtistSongTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testIndex(): void
|
|
|
|
{
|
|
|
|
/** @var Artist $artist */
|
|
|
|
$artist = Artist::factory()->create();
|
|
|
|
|
2022-07-27 08:49:33 +00:00
|
|
|
Song::factory(5)->for($artist)->create();
|
2022-07-26 20:23:34 +00:00
|
|
|
|
2022-07-27 08:49:33 +00:00
|
|
|
$this->getAs('api/artists/' . $artist->id . '/songs')
|
2022-07-26 20:23:34 +00:00
|
|
|
->assertJsonStructure(['*' => SongTest::JSON_STRUCTURE]);
|
|
|
|
}
|
|
|
|
}
|