-
-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
40 deletions.
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
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 |
---|---|---|
|
@@ -39,9 +39,9 @@ public function search_specific_thread_by_subject(): void | |
|
||
$threads = Thread::getBySubject('first subject'); | ||
|
||
$this->assertEquals(1, $threads->count()); | ||
$this->assertEquals(1, $threads->first()->id); | ||
$this->assertEquals('first subject', $threads->first()->subject); | ||
$this->assertSame(1, $threads->count()); | ||
$this->assertSame(1, $threads->first()->id); | ||
$this->assertSame('first subject', $threads->first()->subject); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -52,23 +52,23 @@ public function search_threads_by_subject(): void | |
|
||
$threads = Thread::getBySubject('%subject'); | ||
|
||
$this->assertEquals(2, $threads->count()); | ||
$this->assertSame(2, $threads->count()); | ||
|
||
$this->assertEquals(1, $threads->first()->id); | ||
$this->assertEquals('first subject', $threads->first()->subject); | ||
$this->assertSame(1, $threads->first()->id); | ||
$this->assertSame('first subject', $threads->first()->subject); | ||
|
||
$this->assertEquals(2, $threads->last()->id); | ||
$this->assertEquals('second subject', $threads->last()->subject); | ||
$this->assertSame(2, $threads->last()->id); | ||
$this->assertSame('second subject', $threads->last()->subject); | ||
} | ||
|
||
/** @test */ | ||
public function it_should_create_a_new_thread(): void | ||
{ | ||
$thread = $this->threadFactory(); | ||
$this->assertEquals('Sample thread', $thread->subject); | ||
$this->assertSame('Sample thread', $thread->subject); | ||
|
||
$thread = $this->threadFactory(['subject' => 'Second sample thread']); | ||
$this->assertEquals('Second sample thread', $thread->subject); | ||
$this->assertSame('Second sample thread', $thread->subject); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -85,7 +85,7 @@ public function it_should_return_the_latest_message(): void | |
|
||
$thread = $this->threadFactory(); | ||
$thread->messages()->saveMany([$oldMessage, $newMessage]); | ||
$this->assertEquals($newMessage->body, $thread->latestMessage->body); | ||
$this->assertSame($newMessage->body, $thread->latestMessage->body); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -117,11 +117,11 @@ public function it_should_get_all_thread_participants(): void | |
|
||
$participantIds = $thread->participantsUserIds(); | ||
$this->assertCount(3, $participantIds); | ||
$this->assertEquals(2, $participantIds[1]); | ||
$this->assertSame('2', $participantIds[1]); | ||
|
||
$participantIds = $thread->participantsUserIds(999); | ||
$this->assertCount(4, $participantIds); | ||
$this->assertEquals(999, end($participantIds)); | ||
$this->assertSame(999, end($participantIds)); | ||
|
||
$this->assertIsArray($participantIds); | ||
} | ||
|
@@ -254,7 +254,7 @@ public function it_should_add_a_participant_to_a_thread(): void | |
|
||
$thread->addParticipant($participant); | ||
|
||
$this->assertEquals(1, $thread->participants()->count()); | ||
$this->assertSame(1, $thread->participants()->count()); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -266,7 +266,7 @@ public function it_should_add_participants_to_a_thread_with_array(): void | |
|
||
$thread->addParticipant($participants); | ||
|
||
$this->assertEquals(3, $thread->participants()->count()); | ||
$this->assertSame(3, $thread->participants()->count()); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -276,7 +276,7 @@ public function it_should_add_participants_to_a_thread_with_arguments(): void | |
|
||
$thread->addParticipant(1, 2); | ||
|
||
$this->assertEquals(2, $thread->participants()->count()); | ||
$this->assertSame(2, $thread->participants()->count()); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -291,7 +291,7 @@ public function it_should_mark_the_participant_as_read(): void | |
|
||
$thread->markAsRead($userId); | ||
|
||
$this->assertNotEquals($thread->getParticipantFromUser($userId)->last_read, $last_read); | ||
$this->assertNotSame($thread->getParticipantFromUser($userId)->last_read, $last_read); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -355,12 +355,12 @@ public function it_should_activate_all_deleted_participants(): void | |
$thread->participants()->saveMany([$user_1, $user_2, $user_3]); | ||
|
||
$participants = $thread->participants(); | ||
$this->assertEquals(0, $participants->count()); | ||
$this->assertSame(0, $participants->count()); | ||
|
||
$thread->activateAllParticipants(); | ||
|
||
$participants = $thread->participants(); | ||
$this->assertEquals(3, $participants->count()); | ||
$this->assertSame(3, $participants->count()); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -375,18 +375,18 @@ public function it_should_generate_participant_select_string(): void | |
$expectedString = '(' . Eloquent::getConnectionResolver()->getTablePrefix() . $tableName . '.name) as name'; | ||
|
||
if (config('database.connections.testbench.driver') === 'mysql') { | ||
$this->assertEquals('concat' . $expectedString, $select); | ||
$this->assertSame('concat' . $expectedString, $select); | ||
} else { | ||
$this->assertEquals($expectedString, $select); | ||
$this->assertSame($expectedString, $select); | ||
} | ||
|
||
$columns = ['name', 'email']; | ||
$select = $method->invokeArgs($thread, [$columns]); | ||
|
||
if (config('database.connections.testbench.driver') === 'mysql') { | ||
$this->assertEquals('concat(' . Eloquent::getConnectionResolver()->getTablePrefix() . $tableName . ".name, ' ', " . Eloquent::getConnectionResolver()->getTablePrefix() . $tableName . '.email) as name', $select); | ||
$this->assertSame('concat(' . Eloquent::getConnectionResolver()->getTablePrefix() . $tableName . ".name, ' ', " . Eloquent::getConnectionResolver()->getTablePrefix() . $tableName . '.email) as name', $select); | ||
} else { | ||
$this->assertEquals('(' . Eloquent::getConnectionResolver()->getTablePrefix() . $tableName . ".name || ' ' || " . Eloquent::getConnectionResolver()->getTablePrefix() . $tableName . '.email) as name', $select); | ||
$this->assertSame('(' . Eloquent::getConnectionResolver()->getTablePrefix() . $tableName . ".name || ' ' || " . Eloquent::getConnectionResolver()->getTablePrefix() . $tableName . '.email) as name', $select); | ||
} | ||
} | ||
|
||
|
@@ -404,13 +404,13 @@ public function it_should_get_participants_string(): void | |
$thread->participants()->saveMany([$participant_1, $participant_2, $participant_3]); | ||
|
||
$string = $thread->participantsString(); | ||
$this->assertEquals('Chris Gmyr, Adam Wathan, Taylor Otwell', $string); | ||
$this->assertSame('Chris Gmyr, Adam Wathan, Taylor Otwell', $string); | ||
|
||
$string = $thread->participantsString(1); | ||
$this->assertEquals('Adam Wathan, Taylor Otwell', $string); | ||
$this->assertSame('Adam Wathan, Taylor Otwell', $string); | ||
|
||
$string = $thread->participantsString(1, ['email']); | ||
$this->assertEquals('[email protected], [email protected]', $string); | ||
$this->assertSame('[email protected], [email protected]', $string); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -440,7 +440,7 @@ public function it_should_remove_a_single_participant(): void | |
|
||
$thread->removeParticipant(2); | ||
|
||
$this->assertEquals(1, $thread->participants()->count()); | ||
$this->assertSame(1, $thread->participants()->count()); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -455,7 +455,7 @@ public function it_should_remove_a_group_of_participants_with_array(): void | |
|
||
$thread->removeParticipant([1, 2]); | ||
|
||
$this->assertEquals(0, $thread->participants()->count()); | ||
$this->assertSame(0, $thread->participants()->count()); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -470,7 +470,7 @@ public function it_should_remove_a_group_of_participants_with_arguments(): void | |
|
||
$thread->removeParticipant(1, 2); | ||
|
||
$this->assertEquals(0, $thread->participants()->count()); | ||
$this->assertSame(0, $thread->participants()->count()); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -507,7 +507,7 @@ public function it_should_get_all_unread_messages_for_user(): void | |
|
||
$secondParticipantUnreadMessages = $thread->userUnreadMessages($participant_2->user_id); | ||
$this->assertCount(1, $secondParticipantUnreadMessages); | ||
$this->assertEquals('Message 2', $secondParticipantUnreadMessages->first()->body); | ||
$this->assertSame('Message 2', $secondParticipantUnreadMessages->first()->body); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -544,15 +544,15 @@ public function it_should_get_all_unread_messages_for_user_when_dates_not_set(): | |
|
||
$secondParticipantUnreadMessages = $thread->userUnreadMessages($participant_2->user_id); | ||
$this->assertCount(1, $secondParticipantUnreadMessages); | ||
$this->assertEquals('Message 2', $secondParticipantUnreadMessages->first()->body); | ||
$this->assertSame('Message 2', $secondParticipantUnreadMessages->first()->body); | ||
} | ||
|
||
/** @test */ | ||
public function it_should_return_empty_collection_when_user_not_participant(): void | ||
{ | ||
$thread = $this->threadFactory(); | ||
|
||
$this->assertEquals(0, $thread->userUnreadMessagesCount(1)); | ||
$this->assertSame(0, $thread->userUnreadMessagesCount(1)); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -574,7 +574,7 @@ public function it_should_get_the_creator_of_a_thread(): void | |
|
||
$thread->messages()->saveMany([$message_1, $message_2, $message_3]); | ||
|
||
$this->assertEquals('Chris Gmyr', $thread->creator()->name); | ||
$this->assertSame('Chris Gmyr', $thread->creator()->name); | ||
} | ||
|
||
/** | ||
|
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