From 477b026157080a0b11aa28f78a203e7386f927d1 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Fri, 12 Apr 2024 09:20:31 +0100 Subject: [PATCH] Statamic 5 support (#7) --- .github/workflows/test.yml | 22 +++++++++------------- composer.json | 15 +++++++-------- tests/PreventSavingStacheItemsToDisk.php | 3 ++- tests/TestCase.php | 2 +- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fb441c0..1dfc842 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,20 +7,16 @@ on: jobs: php-tests: runs-on: ${{ matrix.os }} + strategy: matrix: + php: [8.3, 8.2] + laravel: [10.*, 11.*] + statamic: [^5.0] os: [ubuntu-latest] - php: [8.1, 8.2] - laravel: [9.*, 10.*] - dependency-version: [prefer-lowest, prefer-stable] - include: - - laravel: 9.* - framework: ^9.0 - testbench: 7.* - - laravel: 10.* - framework: ^10.0 - testbench: 8.* - name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ubuntu-latest + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.statamic }} - ubuntu-latest + steps: - name: Checkout code uses: actions/checkout@v3 @@ -40,8 +36,8 @@ jobs: - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.framework }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update - composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest + composer require "laravel/framework:${{ matrix.laravel }}" "statamic/cms:${{ matrix.statamic }}" --no-interaction --no-update + composer install --no-interaction - name: Execute tests run: vendor/bin/phpunit -c phpunit.xml diff --git a/composer.json b/composer.json index e17ef26..b02082e 100644 --- a/composer.json +++ b/composer.json @@ -14,18 +14,16 @@ "require": { "php": "^8.1", "bashy/laravel-campaignmonitor": "^6.0", - "edalzell/forma": "^2.0", - "laravel/framework": "^9.0 || ^10.0", + "edalzell/forma": "^3.0", + "laravel/framework": "^10.25.0 || ^11.0", "pixelfear/composer-dist-plugin": "^0.1", - "statamic/cms": "^4.0" + "statamic/cms": "^4.0 || ^5.0" }, "require-dev": { "jasonmccreary/laravel-test-assertions": "^2.0", "mockery/mockery": "^1.3.1", - "nunomaduro/collision": "^6.0 || ^7.0", - "orchestra/testbench": "^7.0 || ^8.0", - "phpunit/phpunit": "^9.0 || ^10.0", - "spatie/laravel-ray": "*" + "orchestra/testbench": "^7.0 || ^8.0 || ^9.0", + "phpunit/phpunit": "^9.0 || ^10.0" }, "autoload": { "psr-4": { @@ -56,5 +54,6 @@ "description": "Campaign Monitor addon", "name": "Campaign Monitor" } - } + }, + "minimum-stability": "alpha" } diff --git a/tests/PreventSavingStacheItemsToDisk.php b/tests/PreventSavingStacheItemsToDisk.php index 31a1f4c..f59f32a 100644 --- a/tests/PreventSavingStacheItemsToDisk.php +++ b/tests/PreventSavingStacheItemsToDisk.php @@ -4,6 +4,7 @@ use Statamic\Facades\Path; use Statamic\Facades\Stache; +use Statamic\Support\Str; trait PreventSavingStacheItemsToDisk { @@ -15,7 +16,7 @@ protected function preventSavingStacheItemsToDisk() Stache::stores()->each(function ($store) { $dir = Path::tidy(__DIR__.'/__fixtures__'); - $relative = str_after(str_after($store->directory(), $dir), '/'); + $relative = Str::after(Str::after($store->directory(), $dir), '/'); $store->directory($this->fakeStacheDirectory.'/'.$relative); }); } diff --git a/tests/TestCase.php b/tests/TestCase.php index cf74417..df4cdee 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -58,7 +58,7 @@ protected function resolveApplicationConfiguration($app) { parent::resolveApplicationConfiguration($app); - $configs = ['assets', 'cp', 'forms', 'routes', 'static_caching', 'sites', 'stache', 'system', 'users']; + $configs = ['assets', 'cp', 'forms', 'routes', 'static_caching', 'stache', 'system', 'users']; foreach ($configs as $config) { $app['config']->set("statamic.$config", require __DIR__."/../vendor/statamic/cms/config/{$config}.php");