diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 54f6d85..0df0700 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: matrix: php: [7.4, 8.0, 8.1, 8.2, 8.3] laravel: [8.*, 9.*, 10.*, 11.*, 12.*] - statamic: [3.*, 4.*, 5.*] + statamic: [3.*, 4.*, 5.*, 6.*] exclude: - laravel: 8.* php: 8.2 @@ -48,7 +48,23 @@ jobs: - laravel: 12.* statamic: 3.* - laravel: 12.* - statamic: 4.* + statamic: 4.* + - laravel: 8.* + statamic: 6.* + - laravel: 9.* + statamic: 6.* + - laravel: 10.* + statamic: 6.* + - laravel: 11.* + statamic: 6.* + - statamic: 6.* + php: 7.4 + - statamic: 6.* + php: 8.0 + - statamic: 6.* + php: 8.1 + - statamic: 6.* + php: 8.2 dependency-version: [prefer-stable] name: P${{ matrix.php }} - L${{ matrix.laravel }} - S${{ matrix.statamic }} @@ -68,6 +84,13 @@ jobs: run: | echo "::add-matcher::${{ runner.tool_cache }}/php.json" echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Set minimum-stability to dev for Statamic 6 + if: matrix.statamic == '6.*' + run: composer config minimum-stability dev + + - name: Disable Composer security audit blocking + run: composer config audit.block-insecure false + - name: Install dependencies run: composer require laravel/framework:${{ matrix.laravel }} statamic/cms:${{ matrix.statamic }} --prefer-dist --no-interaction --no-suggest diff --git a/composer.json b/composer.json index 93c6445..acd850e 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "require": { "php": "^7.4|^8.0", "laravel/framework": "^7.30.3|^8.24|^9.0|^10.0|^11.0|^12.0", - "statamic/cms": "^3.0.0|^4.0|^5.0" + "statamic/cms": "^3.0.0|^4.0|^5.0|^6.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.8", diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 6f494ce..07926cb 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -6,6 +6,10 @@ class ServiceProvider extends AddonServiceProvider { + protected $commands = [ + ClearAssets::class, + ]; + public function bootAddon() { /** @@ -18,9 +22,5 @@ public function bootAddon() 'statamic-clear-assets' ); } - - $this->commands([ - ClearAssets::class, - ]); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 2514d7f..ff3d0db 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -4,7 +4,6 @@ use Statamic\Statamic; use Statamic\Assets\Asset; -use Statamic\Extend\Manifest; use Illuminate\Support\Facades\File; use Orchestra\Testbench\TestCase as OrchestraTestCase; use Swiftmade\StatamicClearAssets\Tests\Concerns\ManagesAssetContainers; @@ -82,12 +81,26 @@ protected function getEnvironmentSetUp($app) { parent::getEnvironmentSetUp($app); - $app->make(Manifest::class)->manifest = [ - 'swiftmade/statamic-clear-assets' => [ - 'id' => 'swiftmade/statamic-clear-assets', - 'namespace' => 'Swiftmade\\StatamicClearAssets', - ], - ]; + // Statamic 6 uses Statamic\Addons\Manifest, older versions use Statamic\Extend\Manifest + if (class_exists(\Statamic\Addons\Manifest::class)) { + // Statamic 6+ + $app->make(\Statamic\Addons\Manifest::class)->manifest = [ + 'swiftmade/statamic-clear-assets' => [ + 'id' => 'swiftmade/statamic-clear-assets', + 'namespace' => 'Swiftmade\\StatamicClearAssets', + 'autoload' => 'src', + 'provider' => \Swiftmade\StatamicClearAssets\ServiceProvider::class, + ], + ]; + } elseif (class_exists(\Statamic\Extend\Manifest::class)) { + // Statamic 3-5 + $app->make(\Statamic\Extend\Manifest::class)->manifest = [ + 'swiftmade/statamic-clear-assets' => [ + 'id' => 'swiftmade/statamic-clear-assets', + 'namespace' => 'Swiftmade\\StatamicClearAssets', + ], + ]; + } } protected function resolveApplicationConfiguration($app)