Skip to content

Commit

Permalink
Support Laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentBean committed Mar 29, 2024
1 parent 8e8ec00 commit e8bb4d3
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 26 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1]
laravel: [10.*]
php: [8.3]
laravel: [10.*, 11.*]
stability: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: coverage

on: ['push', 'pull_request']

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.3]
laravel: [10.*, 11.*]
stability: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, xdebug
coverage: xdebug

- name: Install dependencies
run: |
composer config allow-plugins.pestphp/pest-plugin true
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" pestphp/pest --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: XDEBUG_MODE=coverage php vendor/bin/pest --coverage --min=100
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,23 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2]
laravel: [10.*]
php: [8.1, 8.2, 8.3]
laravel: [10.*, 11.*]
stability: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 11.*
php: 8.1

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"license": "MIT",
"require": {
"php": "^8.1",
"justbetter/laravel-magento-client": "^1.1.0",
"laravel/framework": "^10.0"
"justbetter/laravel-magento-client": "^2.4",
"laravel/framework": "^10.0|^11.0"
},
"require-dev": {
"laravel/pint": "^1.6",
"nunomaduro/larastan": "^2.5",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"phpstan/phpstan-mockery": "^1.1",
"phpunit/phpunit": "^10.0",
"doctrine/dbal": "^3.7.1"
"doctrine/dbal": "^3.7.1",
"larastan/larastan": "^2.9",
"laravel/pint": "^1.6",
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^2.0",
"phpstan/phpstan-mockery": "^1.1",
"phpunit/phpunit": "^10.0"
},
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
includes:
- ./vendor/nunomaduro/larastan/extension.neon
- ./vendor/larastan/larastan/extension.neon
- ./vendor/phpstan/phpstan-mockery/extension.neon

parameters:
Expand Down
4 changes: 2 additions & 2 deletions tests/Actions/CheckMagentoExistenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function test_new_existing_product(): void
$this->assertTrue($this->action->exists('123'));
$this->assertTrue(MagentoProduct::query()->where('sku', '123')->first()->exists_in_magento); /** @phpstan-ignore-line */
Http::assertSent(function (Request $request) {
return $request->url() === 'rest/all/V1/products/123?fields=sku';
return $request->url() === 'magento/rest/all/V1/products/123?fields=sku';
});
}

Expand All @@ -53,7 +53,7 @@ public function test_new_non_existing_product(): void
$this->assertFalse($this->action->exists('456'));
$this->assertFalse(MagentoProduct::query()->where('sku', '456')->first()->exists_in_magento); /** @phpstan-ignore-line */
Http::assertSent(function (Request $request) {
return $request->url() === 'rest/all/V1/products/456?fields=sku';
return $request->url() === 'magento/rest/all/V1/products/456?fields=sku';
});
}

Expand Down
12 changes: 6 additions & 6 deletions tests/Actions/RetrieveProductDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function test_it_retrieves_new_product(): void
$this->assertEquals(['456'], $data);

Http::assertSent(function (Request $request) {
return $request->url() == 'rest/all/V1/products/123%2B456';
return $request->url() == 'magento/rest/all/V1/products/123%2B456';
});
}

Expand All @@ -60,7 +60,7 @@ public function test_it_retrieves_product_for_store(): void
$this->assertEquals('some_store', $createdProduct->store);

Http::assertSent(function (Request $request) {
return $request->url() == 'rest/some_store/V1/products/789';
return $request->url() == 'magento/rest/some_store/V1/products/789';
});
}

Expand All @@ -71,7 +71,7 @@ public function test_it_retrieves_missing_product(): void
$this->assertNull($data);
$this->assertFalse(MagentoProduct::query()->where('sku', '404')->first()->exists_in_magento); /** @phpstan-ignore-line */
Http::assertSent(function (Request $request) {
return $request->url() == 'rest/all/V1/products/404';
return $request->url() == 'magento/rest/all/V1/products/404';
});
}

Expand All @@ -84,7 +84,7 @@ public function test_it_rechecks_on_interval(): void
$this->assertEquals(['123'], $data);

Http::assertSent(function (Request $request) {
return $request->url() == 'rest/all/V1/products/123';
return $request->url() == 'magento/rest/all/V1/products/123';
});
}

Expand All @@ -97,7 +97,7 @@ public function test_it_forces_recheck(): void
$this->assertEquals(['123'], $data);

Http::assertSent(function (Request $request) {
return $request->url() == 'rest/all/V1/products/123';
return $request->url() == 'magento/rest/all/V1/products/123';
});
}

Expand All @@ -110,7 +110,7 @@ public function test_it_returns_null_when_check_fails(): void
$this->assertNull($data);

Http::assertSent(function (Request $request) {
return $request->url() == 'rest/all/V1/products/404';
return $request->url() == 'magento/rest/all/V1/products/404';
});
}
}
3 changes: 3 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace JustBetter\MagentoProducts\Tests;

use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use JustBetter\MagentoClient\Client\Magento;
use JustBetter\MagentoProducts\ServiceProvider;
use Orchestra\Testbench\TestCase as BaseTestCase;

Expand All @@ -23,6 +24,8 @@ protected function defineEnvironment($app): void
'database' => ':memory:',
'prefix' => '',
]);

Magento::fake();
}

protected function getPackageProviders($app): array
Expand Down

0 comments on commit e8bb4d3

Please sign in to comment.