From 4da785b08b260bd45971074aac31bc43768f221c Mon Sep 17 00:00:00 2001 From: leopado Date: Fri, 23 Oct 2020 17:05:00 +0200 Subject: [PATCH] added support for laravel 8 --- composer.json | 2 +- tests/ActivityModelTest.php | 2 +- tests/TestCase.php | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 762753a..cfed065 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ }, "require-dev": { "ext-json": "*", - "orchestra/testbench": "^4.0|^5.0", + "orchestra/testbench": "^4.0|^5.0|^6.0", "phpunit/phpunit": "^8.0|^9.0" }, "autoload": { diff --git a/tests/ActivityModelTest.php b/tests/ActivityModelTest.php index a29a34c..b0b5792 100644 --- a/tests/ActivityModelTest.php +++ b/tests/ActivityModelTest.php @@ -120,7 +120,7 @@ public function it_provides_a_scope_to_get_all_log_items_related_to_subject() $this->assertCount(1, $activities); - $this->assertRegexp('/users":"'.$user2->id.'"/',json_encode($activities->first()->properties)); + $this->assertMatchesRegularExpression('/users":"'.$user2->id.'"/',json_encode($activities->first()->properties)); $this->assertEquals($causer->getKey(), $activities->first()->causer_id); $this->assertEquals(get_class($causer), $activities->first()->causer_type); $this->assertEquals($Article->getKey(), $activities->first()->subject_id); diff --git a/tests/TestCase.php b/tests/TestCase.php index 57f0280..725a3ca 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -72,12 +72,15 @@ protected function createActivityLogTable() include_once '__DIR__'.'/../vendor/spatie/laravel-activitylog/migrations/create_activity_log_table.php.stub'; (new \CreateActivityLogTable())->up(); + if (file_exists('__DIR__'.'/../vendor/spatie/laravel-activitylog/migrations/add_event_column_to_activity_log_table.php.stub')){ + include_once '__DIR__'.'/../vendor/spatie/laravel-activitylog/migrations/add_event_column_to_activity_log_table.php.stub'; + (new \AddEventColumnToActivityLogTable())->up(); + } - include_once '__DIR__'.'/../vendor/spatie/laravel-activitylog/migrations/add_event_column_to_activity_log_table.php.stub'; - (new \AddEventColumnToActivityLogTable())->up(); - include_once '__DIR__'.'/..//migrations/enhance_activity_log_table.php.stub'; + + include_once '__DIR__'.'/../migrations/enhance_activity_log_table.php.stub'; (new \EnhanceActivityLogTable())->up(); }