From e8e16f4eb3337b2e13978cad80ef7b34ad6dfe49 Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Thu, 21 Nov 2019 20:33:23 +0200 Subject: [PATCH 1/5] Updated to Laravel 6.0+ --- composer.json | 7 ++++--- tests/TestCase.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index a16bece..2ac5974 100644 --- a/composer.json +++ b/composer.json @@ -22,11 +22,12 @@ } ], "require": { - "laravel/framework": "~5.5" + "laravel/framework": "~5.5|^6.0" }, "require-dev": { - "phpunit/phpunit": "^6.2|^7.0", - "orchestra/testbench": "~3.5.0|~3.6.0" + "phpunit/phpunit": "^6.2|^7.0|^8.0", + "orchestra/testbench": "~3.5.0|~3.6.0|~4.0.0", + "orchestra/database": "~3.5.0|~3.6.0|~4.0.0" }, "autoload": { "psr-4": { diff --git a/tests/TestCase.php b/tests/TestCase.php index 9abd1fc..249f8b4 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -8,7 +8,7 @@ abstract class TestCase extends Orchestra { - public function setUp() + public function setUp(): void { parent::setUp(); From f681bd4d49615fc6036f9376f5cc0d9194b50ed2 Mon Sep 17 00:00:00 2001 From: rennokki Date: Thu, 21 Nov 2019 20:35:49 +0200 Subject: [PATCH 2/5] Apply fixes from StyleCI (#14) --- database/migrations/2018_05_19_135648_schedules.php | 4 ++-- src/TimeRange.php | 2 +- src/Traits/HasSchedule.php | 12 ++++++------ tests/TestCase.php | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/database/migrations/2018_05_19_135648_schedules.php b/database/migrations/2018_05_19_135648_schedules.php index 6c849b1..a16b3cb 100644 --- a/database/migrations/2018_05_19_135648_schedules.php +++ b/database/migrations/2018_05_19_135648_schedules.php @@ -1,8 +1,8 @@ getSchedule()[$dateOrDay]) > 0); } @@ -209,7 +209,7 @@ public function isAvailableOnAt($dateOrDay, $time): bool { $timeRanges = null; - if (in_array($dateOrDay, Self::$availableDays)) { + if (in_array($dateOrDay, self::$availableDays)) { $timeRanges = $this->getSchedule()[$dateOrDay]; } @@ -267,7 +267,7 @@ public function getHoursOn($dateOrDay): int $totalHours = 0; $timeRanges = null; - if (in_array($dateOrDay, Self::$availableDays)) { + if (in_array($dateOrDay, self::$availableDays)) { $timeRanges = $this->getSchedule()[$dateOrDay]; } @@ -311,7 +311,7 @@ public function getMinutesOn($dateOrDay): int $totalMinutes = 0; $timeRanges = null; - if (in_array($dateOrDay, Self::$availableDays)) { + if (in_array($dateOrDay, self::$availableDays)) { $timeRanges = $this->getSchedule()[$dateOrDay]; } @@ -415,12 +415,12 @@ protected function normalizeScheduleArray(array $scheduleArray): array { $finalScheduleArray = []; - foreach (Self::$availableDays as $availableDay) { + foreach (self::$availableDays as $availableDay) { $finalScheduleArray[$availableDay] = []; } foreach ($scheduleArray as $day => $timeArray) { - if (! in_array($day, Self::$availableDays)) { + if (! in_array($day, self::$availableDays)) { continue; } diff --git a/tests/TestCase.php b/tests/TestCase.php index 249f8b4..bf5f192 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,9 +2,9 @@ namespace Rennokki\Schedule\Test; -use Rennokki\Schedule\Test\Models\User; -use Rennokki\Schedule\Models\ScheduleModel; use Orchestra\Testbench\TestCase as Orchestra; +use Rennokki\Schedule\Models\ScheduleModel; +use Rennokki\Schedule\Test\Models\User; abstract class TestCase extends Orchestra { From 03f6984fe2138b6a3ffc59706e26ec0a668e44ef Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Thu, 21 Nov 2019 20:36:24 +0200 Subject: [PATCH 3/5] Raised the php to 7.2+ --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3a6b774..aea45fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: php php: - - 7.1 - 7.2 + - 7.3 env: matrix: From 763e556701132c0b0dc501efcaec86a55fe09bb4 Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Thu, 21 Nov 2019 20:40:04 +0200 Subject: [PATCH 4/5] Fixed void. --- tests/ScheduleTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ScheduleTest.php b/tests/ScheduleTest.php index 5ee8f5f..34f1339 100644 --- a/tests/ScheduleTest.php +++ b/tests/ScheduleTest.php @@ -13,7 +13,7 @@ class ScheduleTest extends TestCase 'saturday', 'sunday', ]; - public function setUp() + public function setUp(): void { parent::setUp(); From 8ee2991ff820770fb30ad63fa5bd7d4c995f2a44 Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Thu, 21 Nov 2019 20:45:34 +0200 Subject: [PATCH 5/5] Replaced str_random with Str::random --- database/factories/UserFactory.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 790e8eb..43cc188 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -1,4 +1,7 @@ define(\Rennokki\Schedule\Test\Models\User::class, function () { return [ - 'name' => 'Name'.str_random(5), - 'email' => str_random(5).'@gmail.com', + 'name' => 'Name'.Str::random(5), + 'email' => Str::random(5).'@gmail.com', 'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret - 'remember_token' => str_random(10), + 'remember_token' => Str::random(10), ]; });