Skip to content

Update to Laravel 10 #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@ jobs:
matrix:
db: ['mysql', 'pgsql']
payload:
- { queue: 'github-actions-laravel9-php81', laravel: '10.*', php: '8.2', 'testbench': '8.*'}
- { queue: 'github-actions-laravel9-php81', laravel: '10.*', php: '8.1', 'testbench': '8.*'}
- { queue: 'github-actions-laravel9-php81', laravel: '9.*', php: '8.2', 'testbench': '7.*'}
- { queue: 'github-actions-laravel9-php81', laravel: '9.*', php: '8.1', 'testbench': '7.*'}
- { queue: 'github-actions-laravel9-php80', laravel: '9.*', php: '8.0', 'testbench': '7.*'}
- { queue: 'github-actions-laravel8-php81', laravel: '8.*', php: '8.1', 'testbench': '6.*'}
- { queue: 'github-actions-laravel8-php80', laravel: '8.*', php: '8.0', 'testbench': '6.*'}
- { queue: 'github-actions-laravel8-php74', laravel: '8.*', php: '7.4', 'testbench': '6.*'}
- { queue: 'github-actions-laravel7-php80', laravel: '7.*', php: '8.0', 'testbench': '5.*' }
- { queue: 'github-actions-laravel7-php74', laravel: '7.*', php: '7.4', 'testbench': '5.*' }
- { queue: 'github-actions-laravel6-php80', laravel: '6.*', php: '8.0', 'testbench': '4.*' }
- { queue: 'github-actions-laravel6-php74', laravel: '6.*', php: '7.4', 'testbench': '4.*' }

name: PHP ${{ matrix.payload.php }} - Laravel ${{ matrix.payload.laravel }} - DB ${{ matrix.db }}

steps:
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 3.4.0 - 2023-02-08

**Changed**

- Added support for Laravel 10
- Dropped support for Laravel 6 and 7

## 3.3.2 - 2022-11-19

**Changed**
Expand Down
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,9 @@ This package allows Google Cloud Tasks to be used as the queue driver.
</summary>

<br>
This package requires Laravel 6 or higher and supports MySQL 8 and PostgreSQL 14. Might support older database versions too, but package hasn't been tested for it.
This package requires Laravel 8 or higher and supports MySQL 8 and PostgreSQL 14. Might support older database versions too, but package hasn't been tested for it.

Please check the table below for supported Laravel and PHP versions:

|Laravel Version| PHP Version |
|---|---|
| 6.x | 7.4 or 8.0
| 7.x | 7.4 or 8.0
| 8.x | 7.4 or 8.0 or 8.1
| 9.x | 8.0 or 8.1
Please check the [Laravel support policy](https://laravel.com/docs/master/releases#support-policy) table for supported Laravel and PHP versions.
</details>
<details>
<summary>Installation</summary>
Expand Down
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
"ext-json": "*",
"phpseclib/phpseclib": "~2.0",
"google/cloud-tasks": "^1.10",
"illuminate/support": "^8.0|^9.0|^10.0",
"thecodingmachine/safe": "^1.0|^2.0"
},
"require-dev": {
"orchestra/testbench": "^4.0 || ^5.0 || ^6.0 || ^7.0",
"orchestra/testbench": "^6.0 || ^7.0 || ^8.0",
"nunomaduro/larastan": "^1.0 || ^2.0",
"thecodingmachine/phpstan-safe-rule": "^1.2",
"laravel/legacy-factories": "^1.3"
Expand All @@ -37,7 +38,13 @@
]
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"l10": [
"composer require laravel/framework:10.* orchestra/testbench:8.* --no-interaction --no-update",
"composer update --prefer-stable --prefer-dist --no-interaction --no-suggest"
],
"l9": [
"composer require laravel/framework:9.* orchestra/testbench:7.* --no-interaction --no-update",
"composer update --prefer-stable --prefer-dist --no-interaction --no-suggest"
Expand Down
42 changes: 17 additions & 25 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Testsuite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_DEBUG" value="1"/>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="MAIL_DRIVER" value="log"/>
<env name="GOOGLE_APPLICATION_CREDENTIALS" value="./tests/Support/gcloud-key-valid.json" />
<env name="QUEUE_DRIVER" value="cloudtasks"/>
<env name="DB_DRIVER" value="mysql" />
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Testsuite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_DEBUG" value="1"/>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="MAIL_DRIVER" value="log"/>
<env name="GOOGLE_APPLICATION_CREDENTIALS" value="./tests/Support/gcloud-key-valid.json"/>
<env name="QUEUE_DRIVER" value="cloudtasks"/>
<env name="DB_DRIVER" value="mysql"/>
</php>
</phpunit>
10 changes: 4 additions & 6 deletions tests/TaskHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,18 @@ public function it_returns_responses_for_invalid_json($debug)
// Assert
if ($debug) {
$response->assertJsonValidationErrors('task');
$this->assertEquals('The json must be a valid JSON string.', $response->json('errors.json.0'));
} else {
$response->assertNotFound();
}
}

/**
* @test
* @testWith ["{\"invalid\": \"data\"}", "The task.data field is required."]
* ["{\"data\": \"\"}", "The task.data field is required."]
* ["{\"data\": \"test\"}", "The task.data must be an array."]
* @testWith ["{\"invalid\": \"data\"}"]
* ["{\"data\": \"\"}"]
* ["{\"data\": \"test\"}"]
*/
public function it_returns_responses_for_invalid_payloads(string $payload, string $expectedMessage)
public function it_returns_responses_for_invalid_payloads(string $payload)
{
// Arrange

Expand All @@ -107,7 +106,6 @@ public function it_returns_responses_for_invalid_payloads(string $payload, strin

// Assert
$response->assertJsonValidationErrors('task.data');
$this->assertEquals($expectedMessage, $response->json(['errors', 'task.data', 0]));
}

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ protected function getEnvironmentSetUp($app)

$disableDashboardPrefix = 'when_dashboard_is_disabled';

if (substr($this->getName(), 0, strlen($disableDashboardPrefix)) === $disableDashboardPrefix) {
$testName = method_exists($this, 'name') ? $this->name() : $this->getName();
if (substr($testName, 0, strlen($disableDashboardPrefix)) === $disableDashboardPrefix) {
$app['config']->set('cloud-tasks.dashboard.enabled', false);
} else {
$app['config']->set('cloud-tasks.dashboard.enabled', true);
Expand Down