From ea2539ff7ac2e46d4ac473f6bc94c7a320319986 Mon Sep 17 00:00:00 2001 From: atymic Date: Thu, 10 Sep 2020 09:58:38 +1000 Subject: [PATCH] feat: support laravel 8 (#61) --- .github/workflows/php.yml | 32 ++++++++++++++++++++++++++++++++ .gitignore | 1 + .travis.yml | 38 -------------------------------------- composer.json | 7 ++++--- tests/SendCommandTest.php | 8 +++++--- 5 files changed, 42 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/php.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..5724c97 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,32 @@ +name: PHP + +on: [push] + +jobs: + run: + runs-on: ubuntu-latest + strategy: + max-parallel: 15 + matrix: + laravel-version: ['^6.0', '^7.0', '^8.0'] + php-versions: ['7.3', '7.4'] + name: PHP ${{ matrix.php-versions }} on ${{ matrix.laravel-version }} + steps: + - name: Checkout + uses: actions/checkout@master + - name: Setup PHP + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, xdebug + coverage: xdebug + - name: Install dependencies + run: | + composer require --no-update --no-interaction "illuminate/support:${{ matrix.laravel-version }}" satooshi/php-coveralls + composer update --no-interaction --prefer-dist --no-suggest + - name: Lint composer.json + run: composer validate + - name: Run Tests + run: composer test:ci + - name: Upload Coverage + run: bash <(curl -s https://codecov.io/bash) diff --git a/.gitignore b/.gitignore index 6a4c798..e98468b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /node_modules /composer.lock /tests/temp +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bbd51b1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -language: php - -sudo: false - -notifications: - email: - on_success: never - on_failure: always - -php: - - 7.2 - - 7.4 - -env: - - LARAVEL_VERSION=5.8.* - - LARAVEL_VERSION=6.0.* - - LARAVEL_VERSION=7.0.* - -dist: xenial - -cache: - directories: - - $HOME/.composer/cache/files - -before_install: - - travis_retry composer self-update --stable -n - - composer validate --no-check-all --strict - - composer require "laravel/framework:${LARAVEL_VERSION}" --no-update -n - -install: - - travis_retry composer install --no-suggest --prefer-dist -n -o - - travis_retry composer require --dev satooshi/php-coveralls - -script: - - composer test:ci - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/composer.json b/composer.json index 3d325d9..da8e1af 100644 --- a/composer.json +++ b/composer.json @@ -17,11 +17,12 @@ ], "require": { "php": ">=7.2.5", - "illuminate/support": "~5.5 || ~6.0 || ~7.0" + "illuminate/support": "~6.0 || ~7.0 || ~8.0" }, "require-dev": { - "orchestra/testbench": "~3.8 || ~4.0|| ~5.0", - "phpunit/phpunit": "^8.0" + "orchestra/testbench": "~4.0|| ~5.0 || ~6.0", + "phpunit/phpunit": "^9.0", + "timacdonald/log-fake": "^1.7" }, "autoload": { "psr-4": { diff --git a/tests/SendCommandTest.php b/tests/SendCommandTest.php index c5d5fd7..b2f8b6b 100644 --- a/tests/SendCommandTest.php +++ b/tests/SendCommandTest.php @@ -9,6 +9,7 @@ use Thomasjohnkane\Snooze\ScheduledNotification; use Thomasjohnkane\Snooze\Tests\Models\User; use Thomasjohnkane\Snooze\Tests\Notifications\TestNotification; +use TiMacDonald\Log\LogFake; class SendCommandTest extends TestCase { @@ -58,6 +59,8 @@ public function testNoScheduledNotifications() public function testItCatchesFailedScheduledNotifications() { + Log::swap(new LogFake()); + $target = User::find(1); $notification = $target->notifyAt(new TestNotification(User::find(2)), Carbon::now()); @@ -66,11 +69,10 @@ public function testItCatchesFailedScheduledNotifications() $model->target = 'gobelygook'; $model->save(); - Log::shouldReceive('error') - ->withSomeOfArgs('unserialize(): Error at offset 0 of 10 bytes'); - $this->artisan('snooze:send') ->expectsOutput('Starting Sending Scheduled Notifications') ->assertExitCode(0); + + Log::assertLoggedMessage('error', 'unserialize(): Error at offset 0 of 10 bytes'); } }