-
database/factories/SourceFactory.php
Open in GitHubuse Domain\Source\Models\Source; use Domain\User\Models\User; $factory->define(Source::class, function () { return [ 'user_id' => function () { return factory(User::class)->create()->id; }, 'is_active' => true, 'website' => faker()->url, 'url' => faker()->url, ]; });
-
tests/Domain/Post/Models/PostTest.php
Open in GitHubuse Tests\TestCase; use Domain\Mute\Models\Mute; use Domain\Post\Models\Post; use Domain\Source\Models\Source; class PostTest extends TestCase { /** @test */ public function muted_source_is_ignored(): void { $source = factory(Source::class)->create(); factory(Post::class)->create([ 'source_id' => $source->id, ]); Mute::make($this->user, $source); $this->assertEquals(0, Post::whereNotMuted($this->user)->count()); } }