Skip to content

Commit 7e4a76a

Browse files
authored
Support Statamic v4 (#266)
1 parent df48578 commit 7e4a76a

File tree

7 files changed

+28
-27
lines changed

7 files changed

+28
-27
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
php: [7.4, 8.0, 8.1]
17-
laravel: [8.*, 9.*]
16+
php: [8.0, 8.1, 8.2]
17+
laravel: [9.*, 10.*]
1818
stability: [prefer-lowest, prefer-stable]
1919
os: [ubuntu-latest]
2020
include:
2121
- os: windows-latest
22-
php: 7.4
23-
laravel: 8.*
22+
php: 8.1
23+
laravel: 9.*
2424
stability: prefer-stable
2525
- os: windows-latest
2626
php: 8.1
27-
laravel: 9.*
27+
laravel: 10.*
2828
stability: prefer-stable
2929
exclude:
30-
- laravel: 9.*
31-
php: 7.4
30+
- php: 8.0
31+
laravel: 10.*
3232

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

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
}
2323
},
2424
"require": {
25-
"statamic/cms": "~3.3.0 || ~3.4.0"
25+
"statamic/cms": "^4.0"
2626
},
2727
"require-dev": {
28-
"orchestra/testbench": "^5.20.0 || ^6.22.0 || ^7.0"
28+
"orchestra/testbench": "^7.0 || ^8.0",
29+
"phpunit/phpunit": "^9.0"
2930
},
3031
"config": {
3132
"allow-plugins": {

src/Blueprint.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function addSeoFields()
6161

6262
static::$addingField = true;
6363

64-
$this->blueprint->ensureFieldInSection('seo', ['type' => 'seo_pro', 'listable' => false, 'display' => 'SEO'], 'SEO');
64+
$this->blueprint->ensureFieldInTab('seo', ['type' => 'seo_pro', 'listable' => false, 'display' => 'SEO'], 'SEO');
6565

6666
static::$addingField = false;
6767
}
@@ -71,7 +71,7 @@ public function addSeoFields()
7171
*/
7272
public function removeSeoFields()
7373
{
74-
$this->blueprint->removeSection('SEO');
74+
$this->blueprint->removeTab('SEO');
7575
}
7676

7777
/**

tests/CascadeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function it_generates_compiled_title_from_cascaded_parts()
111111
/** @test */
112112
public function it_parses_field_references()
113113
{
114-
$entry = Entry::findBySlug('about', 'pages');
114+
$entry = Entry::findByUri('/about')->entry();
115115

116116
$entry->data(['favourite_colour' => 'Red'])->save();
117117

tests/MetaTagTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function it_doesnt_generate_meta_when_seo_is_disabled_on_entry($viewType)
122122
{
123123
$this
124124
->prepareViews($viewType)
125-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), false);
125+
->setSeoOnEntry(Entry::findByUri('/about'), false);
126126

127127
$response = $this->get('/about');
128128
$response->assertSee("<h1>{$viewType}</h1>", false);
@@ -165,7 +165,7 @@ public function it_uses_cascade_to_generate_meta($viewType)
165165
'title' => 'Aboot',
166166
'site_name_separator' => '>',
167167
])
168-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
168+
->setSeoOnEntry(Entry::findByUri('/about'), [
169169
'site_name_position' => 'before',
170170
'site_name_separator' => '--',
171171
]);
@@ -183,7 +183,7 @@ public function it_generates_sanitized_title($viewType)
183183
{
184184
$this
185185
->prepareViews($viewType)
186-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
186+
->setSeoOnEntry(Entry::findByUri('/about'), [
187187
'title' => " It's a me, <b>Mario</b>! ",
188188
'site_name' => ' Cool "Runnings" ',
189189
'site_name_position' => 'before',
@@ -204,7 +204,7 @@ public function it_generates_sanitized_description($viewType)
204204
{
205205
$this
206206
->prepareViews($viewType)
207-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
207+
->setSeoOnEntry(Entry::findByUri('/about'), [
208208
'description' => " It's a me, <b>Mario</b>! ",
209209
]);
210210

@@ -240,7 +240,7 @@ public function it_generates_twitter_handle_meta($viewType)
240240
->setSeoInSiteDefaults([
241241
'twitter_handle' => ' itsmario85 ',
242242
])
243-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
243+
->setSeoOnEntry(Entry::findByUri('/about'), [
244244
'twitter_handle' => '@itsluigi85',
245245
]);
246246

@@ -263,7 +263,7 @@ public function it_generates_social_image($viewType)
263263

264264
$this
265265
->prepareViews($viewType)
266-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
266+
->setSeoOnEntry(Entry::findByUri('/about'), [
267267
'image' => 'img/stetson.jpg',
268268
]);
269269

@@ -286,7 +286,7 @@ public function it_generates_social_image_with_custom_glide_presets($viewType)
286286

287287
$this
288288
->prepareViews($viewType)
289-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
289+
->setSeoOnEntry(Entry::findByUri('/about'), [
290290
'image' => 'img/stetson.jpg',
291291
]);
292292

@@ -308,7 +308,7 @@ public function it_generates_social_image_with_og_glide_preset_only($viewType)
308308

309309
$this
310310
->prepareViews($viewType)
311-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
311+
->setSeoOnEntry(Entry::findByUri('/about'), [
312312
'image' => 'img/stetson.jpg',
313313
]);
314314

@@ -331,7 +331,7 @@ public function it_generates_social_image_with_twitter_glide_preset_only($viewTy
331331

332332
$this
333333
->prepareViews($viewType)
334-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
334+
->setSeoOnEntry(Entry::findByUri('/about'), [
335335
'image' => 'img/stetson.jpg',
336336
]);
337337

@@ -488,7 +488,7 @@ public function it_generates_canonical_url_meta_with_custom_url($viewType)
488488
{
489489
$this
490490
->prepareViews($viewType)
491-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
491+
->setSeoOnEntry(Entry::findByUri('/about'), [
492492
'canonical_url' => 'https://hot-walkings.com/pages/aboot',
493493
]);
494494

@@ -505,7 +505,7 @@ public function it_applies_pagination_to_custom_canonical_url_on_same_domain($vi
505505
{
506506
$this
507507
->prepareViews($viewType)
508-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
508+
->setSeoOnEntry(Entry::findByUri('/about'), [
509509
'canonical_url' => 'http://cool-runnings.com/pages/aboot',
510510
]);
511511

@@ -522,7 +522,7 @@ public function it_doesnt_apply_pagination_to_external_custom_canonical_url($vie
522522
{
523523
$this
524524
->prepareViews($viewType)
525-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
525+
->setSeoOnEntry(Entry::findByUri('/about'), [
526526
'canonical_url' => 'https://hot-walkings.com/pages/aboot',
527527
]);
528528

tests/SitemapTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function it_uses_cascade_to_generate_priorities()
145145
->setSeoOnCollection(Collection::find('pages'), [
146146
'priority' => 0.2,
147147
])
148-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
148+
->setSeoOnEntry(Entry::findByUri('/about')->entry(), [
149149
'priority' => 0.3,
150150
]);
151151

@@ -172,7 +172,7 @@ public function it_uses_cascade_to_generate_frequencies()
172172
->setSeoOnCollection(Collection::find('pages'), [
173173
'change_frequency' => 'daily',
174174
])
175-
->setSeoOnEntry(Entry::findBySlug('about', 'pages'), [
175+
->setSeoOnEntry(Entry::findByUri('/about')->entry(), [
176176
'change_frequency' => 'hourly',
177177
]);
178178

tests/ViewScenarios.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
trait ViewScenarios
66
{
7-
public function viewScenarioProvider()
7+
public static function viewScenarioProvider()
88
{
99
return [
1010
['antlers'],

0 commit comments

Comments
 (0)