From c171029e7a79709feae60838f4a406e213b72571 Mon Sep 17 00:00:00 2001 From: Chris Gmyr Date: Tue, 9 Jun 2020 14:18:20 -0400 Subject: [PATCH 1/7] Create FUNDING.yml --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..21ded7b --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: cmgmyr From 8fa8d3634332923cc8530298883fbd55073ecb38 Mon Sep 17 00:00:00 2001 From: Chris Gmyr Date: Tue, 9 Jun 2020 14:19:31 -0400 Subject: [PATCH 2/7] remove codementor from readme --- readme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/readme.md b/readme.md index d671331..ac338e7 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,6 @@ [![Latest Version](https://img.shields.io/github/release/cmgmyr/laravel-messenger.svg?style=flat-square)](https://github.com/cmgmyr/laravel-messenger/releases) [![Total Downloads](https://img.shields.io/packagist/dt/cmgmyr/messenger.svg?style=flat-square)](https://packagist.org/packages/cmgmyr/messenger) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) -[![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/cmgmyr) # Laravel Messenger This package will allow you to add a full user messaging system into your Laravel application. From 6050461ee7efbee610d70cad68e9e7e1fc953935 Mon Sep 17 00:00:00 2001 From: Raj Janorkar <66419504+rjanorkar@users.noreply.github.com> Date: Wed, 26 Aug 2020 14:38:02 +1000 Subject: [PATCH 3/7] Restore onlyTrashed Participants Restore onlyTrashed Participants, others are already active. --- src/Models/Thread.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Models/Thread.php b/src/Models/Thread.php index 73b8076..957865b 100644 --- a/src/Models/Thread.php +++ b/src/Models/Thread.php @@ -301,13 +301,14 @@ public function getParticipantFromUser($userId) } /** - * Restores all participants within a thread that has a new message. + * Restores only trashed participants within a thread that has a new message. + * Others are already active participiants. * * @return void */ public function activateAllParticipants() { - $participants = $this->participants()->withTrashed()->get(); + $participants = $this->participants()->onlyTrashed()->get(); foreach ($participants as $participant) { $participant->restore(); } From bdf742194cacd5657177002fac1c99818d6a9423 Mon Sep 17 00:00:00 2001 From: Chris Gmyr Date: Fri, 11 Sep 2020 13:51:11 -0400 Subject: [PATCH 4/7] laravel 8 --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index c20c4d4..5510ff8 100644 --- a/composer.json +++ b/composer.json @@ -13,14 +13,14 @@ ], "require": { "php": "^7.1.3", - "illuminate/config": "^5.5|^6.0|^7.0", - "illuminate/support": "^5.5|^6.0|^7.0", - "illuminate/database": "^5.5|^6.0|^7.0" + "illuminate/config": "^5.5|^6.0|^7.0|^8.0", + "illuminate/support": "^5.5|^6.0|^7.0|^8.0", + "illuminate/database": "^5.5|^6.0|^7.0|^8.0" }, "require-dev": { "adamwathan/faktory": "0.3.*", "friendsofphp/php-cs-fixer": "^2.5", - "orchestra/testbench": "^3.0|^4.0|^5.0", + "orchestra/testbench": "^3.0|^4.0|^5.0|^6.0", "phpunit/phpunit": "^7.0" }, "autoload": { From 0d468e3cb659fe3ec9e160a2a29b81d327737bd5 Mon Sep 17 00:00:00 2001 From: Chris Gmyr Date: Fri, 11 Sep 2020 14:39:12 -0400 Subject: [PATCH 5/7] upgrade phpunit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5510ff8..09bcc29 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "adamwathan/faktory": "0.3.*", "friendsofphp/php-cs-fixer": "^2.5", "orchestra/testbench": "^3.0|^4.0|^5.0|^6.0", - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.0" }, "autoload": { "psr-4": { From a080e7fee760b54ec1b640b686843b650b00d723 Mon Sep 17 00:00:00 2001 From: Chris Gmyr Date: Fri, 11 Sep 2020 14:39:25 -0400 Subject: [PATCH 6/7] update tests --- tests/EloquentThreadTest.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/EloquentThreadTest.php b/tests/EloquentThreadTest.php index f18aa81..ed7f038 100644 --- a/tests/EloquentThreadTest.php +++ b/tests/EloquentThreadTest.php @@ -6,6 +6,7 @@ use Cmgmyr\Messenger\Models\Participant; use Cmgmyr\Messenger\Models\Thread; use Illuminate\Database\Eloquent\Model as Eloquent; +use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Support\Carbon; use ReflectionClass; @@ -126,7 +127,7 @@ public function it_should_get_all_thread_participants() $this->assertCount(4, $participantIds); $this->assertEquals(999, end($participantIds)); - $this->assertInternalType('array', $participantIds); + $this->assertIsArray($participantIds); } /** @test */ @@ -154,8 +155,9 @@ public function it_should_get_all_user_entities_for_a_thread() $user_2 = $this->faktory->build('participant', ['user_id' => 2]); $thread->participants()->saveMany([$user_1, $user_2]); - $threadUserIds = $thread->users()->get()->pluck('id')->toArray(); - $this->assertArraySubset([1, 2], $threadUserIds); + $threadUserIds = $thread->users()->get()->pluck('id')->values()->flip(); + $this->assertArrayHasKey(1, $threadUserIds); + $this->assertArrayHasKey(2, $threadUserIds); } /** @test */ @@ -273,15 +275,19 @@ public function it_should_get_a_participant_from_userid() $this->assertInstanceOf(Participant::class, $newParticipant); } - /** - * @test - * @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException - */ + /** @test */ public function it_should_throw_an_exception_when_participant_is_not_found() { - $thread = $this->faktory->create('thread'); + try { + $thread = $this->faktory->create('thread'); + + $thread->getParticipantFromUser(99); + } catch (ModelNotFoundException $e) { + $this->assertTrue(true); + return; + } - $thread->getParticipantFromUser(99); + $this->fail('ModelNotFoundException was not called.'); } /** @test */ From 67903c035934c6ef07ac43ea40ecb2aa628da407 Mon Sep 17 00:00:00 2001 From: Chris Gmyr Date: Fri, 11 Sep 2020 14:49:18 -0400 Subject: [PATCH 7/7] drop 7.1, add 7.4 --- .travis.yml | 4 ++-- composer.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 04f8a4a..9adf143 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,13 @@ language: php php: - - 7.1 - 7.2 - 7.3 + - 7.4 matrix: include: - - php: 7.1 + - php: 7.2 env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"' allow_failures: - php: nightly diff --git a/composer.json b/composer.json index 09bcc29..bcec425 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^7.1.3", + "php": "^7.2", "illuminate/config": "^5.5|^6.0|^7.0|^8.0", "illuminate/support": "^5.5|^6.0|^7.0|^8.0", "illuminate/database": "^5.5|^6.0|^7.0|^8.0"