-
-
Notifications
You must be signed in to change notification settings - Fork 518
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug with broken threads relation
- Loading branch information
1 parent
f4800d5
commit ff1d226
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,24 @@ public function it_should_get_all_threads_with_new_messages() | |
|
||
$this->assertEquals(1, $user->newMessagesCount()); | ||
} | ||
|
||
/** @test */ | ||
public function it_should_get_participant_threads() | ||
{ | ||
$user = User::create( | ||
[ | ||
'name' => 'Jane Doe', | ||
'email' => '[email protected]', | ||
] | ||
); | ||
$thread = $this->faktory->create('thread'); | ||
$user_1 = $this->faktory->build('participant', ['user_id' => $user->id]); | ||
$user_2 = $this->faktory->build('participant', ['user_id' => 2]); | ||
$thread->participants()->saveMany([$user_1, $user_2]); | ||
|
||
$threadsCount = $user->threads->count(); | ||
$this->assertEquals(1, $threadsCount); | ||
} | ||
} | ||
|
||
class User extends Eloquent | ||
|