TestCase::createSampleMediaSet PHP Method

createSampleMediaSet() protected method

Create a sample media set, with a complete artist+album+song trio.
protected createSampleMediaSet ( )
    protected function createSampleMediaSet()
    {
        $artist = factory(Artist::class)->create();
        // Sample 3 albums
        $albums = factory(Album::class, 3)->create(['artist_id' => $artist->id]);
        // 7-15 songs per albums
        foreach ($albums as $album) {
            factory(Song::class, rand(7, 15))->create(['album_id' => $album->id]);
        }
    }