Created
June 13, 2020 20:10
-
-
Save tonyfrenzy/99b5975d2f8d91253608a3cbfc80a348 to your computer and use it in GitHub Desktop.
morphToMany() Many-to-Many Polymorphic Relationship Test (Video-tag) - Testing Model Relationships in Laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\Unit; | |
// ... | |
use App\Video; | |
use Tests\TestCase; | |
use Illuminate\Foundation\Testing\WithFaker; | |
use Illuminate\Foundation\Testing\RefreshDatabase; | |
use Illuminate\Support\Facades\Schema; | |
class VideosTest extends TestCase | |
{ | |
use RefreshDatabase, WithFaker; | |
... | |
/** @test */ | |
public function a_video_morphs_many_tags() | |
{ | |
$this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $this->video->tags); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment