diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ccf1568a..e5337a5d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,22 +13,22 @@ jobs: strategy: matrix: - php: [7.4, 8.0, 8.1] - laravel: [8.*, 9.*] + php: [8.0, 8.1, 8.2] + laravel: [9.*, 10.*] stability: [prefer-lowest, prefer-stable] os: [ubuntu-latest] include: - os: windows-latest - php: 7.4 - laravel: 8.* + php: 8.1 + laravel: 9.* stability: prefer-stable - os: windows-latest php: 8.1 - laravel: 9.* + laravel: 10.* stability: prefer-stable exclude: - - laravel: 9.* - php: 7.4 + - php: 8.0 + laravel: 10.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index c9039a33..ec34cd1b 100644 --- a/composer.json +++ b/composer.json @@ -22,10 +22,11 @@ } }, "require": { - "statamic/cms": "~3.3.0 || ~3.4.0" + "statamic/cms": "^4.0" }, "require-dev": { - "orchestra/testbench": "^5.20.0 || ^6.22.0 || ^7.0" + "orchestra/testbench": "^7.0 || ^8.0", + "phpunit/phpunit": "^9.0" }, "config": { "allow-plugins": { diff --git a/src/Blueprint.php b/src/Blueprint.php index 74f6c1d6..3c89ced2 100644 --- a/src/Blueprint.php +++ b/src/Blueprint.php @@ -61,7 +61,7 @@ public function addSeoFields() static::$addingField = true; - $this->blueprint->ensureFieldInSection('seo', ['type' => 'seo_pro', 'listable' => false, 'display' => 'SEO'], 'SEO'); + $this->blueprint->ensureFieldInTab('seo', ['type' => 'seo_pro', 'listable' => false, 'display' => 'SEO'], 'SEO'); static::$addingField = false; } @@ -71,7 +71,7 @@ public function addSeoFields() */ public function removeSeoFields() { - $this->blueprint->removeSection('SEO'); + $this->blueprint->removeTab('SEO'); } /** diff --git a/tests/CascadeTest.php b/tests/CascadeTest.php index 867ede6e..0d1db087 100644 --- a/tests/CascadeTest.php +++ b/tests/CascadeTest.php @@ -111,7 +111,7 @@ public function it_generates_compiled_title_from_cascaded_parts() /** @test */ public function it_parses_field_references() { - $entry = Entry::findBySlug('about', 'pages'); + $entry = Entry::findByUri('/about')->entry(); $entry->data(['favourite_colour' => 'Red'])->save(); diff --git a/tests/MetaTagTest.php b/tests/MetaTagTest.php index 17a21dce..c23f159c 100644 --- a/tests/MetaTagTest.php +++ b/tests/MetaTagTest.php @@ -122,7 +122,7 @@ public function it_doesnt_generate_meta_when_seo_is_disabled_on_entry($viewType) { $this ->prepareViews($viewType) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), false); + ->setSeoOnEntry(Entry::findByUri('/about'), false); $response = $this->get('/about'); $response->assertSee("

{$viewType}

", false); @@ -165,7 +165,7 @@ public function it_uses_cascade_to_generate_meta($viewType) 'title' => 'Aboot', 'site_name_separator' => '>', ]) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about'), [ 'site_name_position' => 'before', 'site_name_separator' => '--', ]); @@ -183,7 +183,7 @@ public function it_generates_sanitized_title($viewType) { $this ->prepareViews($viewType) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about'), [ 'title' => " It's a me, Mario! ", 'site_name' => ' Cool "Runnings" ', 'site_name_position' => 'before', @@ -204,7 +204,7 @@ public function it_generates_sanitized_description($viewType) { $this ->prepareViews($viewType) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about'), [ 'description' => " It's a me, Mario! ", ]); @@ -240,7 +240,7 @@ public function it_generates_twitter_handle_meta($viewType) ->setSeoInSiteDefaults([ 'twitter_handle' => ' itsmario85 ', ]) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about'), [ 'twitter_handle' => '@itsluigi85', ]); @@ -263,7 +263,7 @@ public function it_generates_social_image($viewType) $this ->prepareViews($viewType) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about'), [ 'image' => 'img/stetson.jpg', ]); @@ -286,7 +286,7 @@ public function it_generates_social_image_with_custom_glide_presets($viewType) $this ->prepareViews($viewType) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about'), [ 'image' => 'img/stetson.jpg', ]); @@ -308,7 +308,7 @@ public function it_generates_social_image_with_og_glide_preset_only($viewType) $this ->prepareViews($viewType) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about'), [ 'image' => 'img/stetson.jpg', ]); @@ -331,7 +331,7 @@ public function it_generates_social_image_with_twitter_glide_preset_only($viewTy $this ->prepareViews($viewType) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about'), [ 'image' => 'img/stetson.jpg', ]); @@ -488,7 +488,7 @@ public function it_generates_canonical_url_meta_with_custom_url($viewType) { $this ->prepareViews($viewType) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about'), [ 'canonical_url' => 'https://hot-walkings.com/pages/aboot', ]); @@ -505,7 +505,7 @@ public function it_applies_pagination_to_custom_canonical_url_on_same_domain($vi { $this ->prepareViews($viewType) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about'), [ 'canonical_url' => 'http://cool-runnings.com/pages/aboot', ]); @@ -522,7 +522,7 @@ public function it_doesnt_apply_pagination_to_external_custom_canonical_url($vie { $this ->prepareViews($viewType) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about'), [ 'canonical_url' => 'https://hot-walkings.com/pages/aboot', ]); diff --git a/tests/SitemapTest.php b/tests/SitemapTest.php index 66fc2198..59af2421 100644 --- a/tests/SitemapTest.php +++ b/tests/SitemapTest.php @@ -145,7 +145,7 @@ public function it_uses_cascade_to_generate_priorities() ->setSeoOnCollection(Collection::find('pages'), [ 'priority' => 0.2, ]) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about')->entry(), [ 'priority' => 0.3, ]); @@ -172,7 +172,7 @@ public function it_uses_cascade_to_generate_frequencies() ->setSeoOnCollection(Collection::find('pages'), [ 'change_frequency' => 'daily', ]) - ->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [ + ->setSeoOnEntry(Entry::findByUri('/about')->entry(), [ 'change_frequency' => 'hourly', ]); diff --git a/tests/ViewScenarios.php b/tests/ViewScenarios.php index 29973d98..8db70e46 100644 --- a/tests/ViewScenarios.php +++ b/tests/ViewScenarios.php @@ -4,7 +4,7 @@ trait ViewScenarios { - public function viewScenarioProvider() + public static function viewScenarioProvider() { return [ ['antlers'],