Skip to content

Commit 7c9cd1d

Browse files
authored
change: update to use updated testsuite (#12)
* change: update to use current testsuite * stan * fix doPublis & doUnpublish * stan again * more stan * changed compatibility to only support SS6
1 parent ea331c6 commit 7c9cd1d

9 files changed

Lines changed: 51 additions & 59 deletions

File tree

.github/workflows/tests.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- .htaccess
1212
- '**.md'
1313
branches:
14-
- master
14+
- 'master'
1515
pull_request:
1616
paths-ignore:
1717
- .chglog/**
@@ -23,25 +23,23 @@ on:
2323
- .htaccess
2424
- '**.md'
2525
branches:
26-
- master
26+
- 'master'
2727

2828
jobs:
29-
silverstripe-module:
30-
name: 🧰 Silverstripe Module Testsuite
31-
uses: syntro-opensource/workflows/.github/workflows/silverstripe-module.yml@master
29+
silverstripe-module-6:
30+
name: 🧰 Silverstripe Module Testsuite 6
31+
uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-6.yml@master
3232
with:
33-
phpunit: false
33+
phpunit: true
3434
phpstan: true
35-
phpcs: true
36-
# silverstripe-client:
37-
# name: 📦 Client Testsuite
38-
# uses: syntro-opensource/workflows/.github/workflows/client.yml@master
39-
# with:
40-
# eslint: true
41-
# eslint_dir: client/src/seo-field/
42-
# eslint_configfile: client/src/seo-field/.eslintrc
43-
# eslint_ext:
44-
# eslint_max-warnings:
45-
# stylelint: true
46-
# stylelint_glob: client/src/seo-field/**/*.scss
47-
# stylelint_max-warnings:
35+
silverstripe-module-codecoverage:
36+
name: 📊 Silverstripe Code Coverage
37+
uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-codecoverage.yml@master
38+
with:
39+
php_version: 8.3
40+
silverstripe_version: 6.0
41+
silverstripe-phpcs:
42+
name: 🧹 Silverstripe PHPCS
43+
uses: syntro-opensource/workflows/.github/workflows/silverstripe-phpcs.yml@master
44+
with:
45+
dir: src/

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
],
1010
"license": "BSD-3-Clause",
1111
"require": {
12-
"silverstripe/framework": "^5 || ^6",
13-
"silverstripe/admin": "^2.0 || ^3.0",
14-
"dnadesign/silverstripe-elemental": "^5 || ^6",
15-
"symbiote/silverstripe-gridfieldextensions": "^4 || ^5"
12+
"silverstripe/framework": "^6",
13+
"silverstripe/admin": "^3.0",
14+
"dnadesign/silverstripe-elemental": "^6",
15+
"symbiote/silverstripe-gridfieldextensions": "^5"
1616
},
1717
"require-dev": {
1818
"squizlabs/php_codesniffer": "^3.0",
19-
"syntro/silverstripe-phpstan": "^1",
20-
"phpunit/phpunit": "^9.5"
19+
"cambis/silverstan": "^2.0",
20+
"phpunit/phpunit": "^11.0"
2121
},
2222
"scripts": {
2323
"phpcs": "~/.composer/vendor/bin/phpcs src/ tests/",

phpstan-dev.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
includes:
2-
- ../../syntro/silverstripe-phpstan/phpstan.neon
2+
- ../../vendor/cambis/silverstan/extension.neon

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
includes:
2-
- vendor/syntro/silverstripe-phpstan/phpstan.neon
2+
- vendor/cambis/silverstan/extension.neon

phpunit.xml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,23 @@
33
bootstrap="vendor/silverstripe/framework/tests/bootstrap.php"
44
colors="true"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
6+
backupStaticProperties="false"
77
beStrictAboutChangesToGlobalState="true"
88
beStrictAboutOutputDuringTests="true"
99
beStrictAboutTestsThatDoNotTestAnything="true"
10-
beStrictAboutTodoAnnotatedTests="true"
1110
failOnRisky="true"
1211
failOnWarning="true"
1312
>
1413
<testsuite name="Default">
15-
<directory>tests/php</directory>
14+
<directory>tests</directory>
1615
</testsuite>
1716

18-
<coverage>
19-
<exclude>
20-
<directory suffix=".php">vendor/</directory>
21-
</exclude>
17+
<source>
2218
<include>
23-
<directory suffix=".php">src</directory>
19+
<directory suffix=".php">./src</directory>
2420
</include>
25-
</coverage>
21+
<exclude>
22+
<directory suffix=".php">vendor</directory>
23+
</exclude>
24+
</source>
2625
</phpunit>

src/Forms/GridFieldConfig_ElementalChildren.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,21 @@ public function __construct($itemsPerPage = null, $showPagination = null, $showA
4040
{
4141
parent::__construct();
4242

43-
$this->addComponent(new GridFieldButtonRow('before'));
44-
$this->addComponent(new GridFieldAddNewButton('buttons-before-left'));
45-
$this->addComponent(new GridFieldToolbarHeader());
46-
$this->addComponent($filter = new GridFieldFilterHeader());
47-
$this->addComponent(new GridFieldDataColumns());
48-
$this->addComponent(new VersionedGridFieldState());
49-
$this->addComponent(new GridFieldEditButton());
43+
$this->addComponent(GridFieldButtonRow::create('before'));
44+
$this->addComponent(GridFieldAddNewButton::create('buttons-before-left'));
45+
$this->addComponent(GridFieldToolbarHeader::create());
46+
$this->addComponent($filter = GridFieldFilterHeader::create());
47+
$this->addComponent(GridFieldDataColumns::create());
48+
$this->addComponent(GridFieldEditButton::create());
5049
$this->addComponent(new GridFieldArchiveAction());
5150
$this->addComponent(new GridFieldUnpublishAction());
5251
$this->addComponent(new GridFieldPublishAction());
53-
$this->addComponent(new GridField_ActionMenu());
54-
$this->addComponent(new GridFieldPageCount('toolbar-header-right'));
55-
$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
56-
$this->addComponent(new GridFieldDetailForm(null, $showPagination, $showAdd));
57-
$this->addComponent(new GridFieldOrderableRows('Sort'));
58-
$this->addComponent(new GridFieldTitleHeader());
59-
60-
$filter->setThrowExceptionOnBadDataType(false);
61-
$pagination->setThrowExceptionOnBadDataType(false);
52+
$this->addComponent(GridField_ActionMenu::create());
53+
$this->addComponent(GridFieldPageCount::create('toolbar-header-right'));
54+
$this->addComponent($pagination = GridFieldPaginator::create($itemsPerPage));
55+
$this->addComponent(GridFieldDetailForm::create(null, $showPagination, $showAdd));
56+
$this->addComponent(GridFieldOrderableRows::create('Sort'));
57+
$this->addComponent(GridFieldTitleHeader::create());
6258

6359
$this->extend('updateConfig');
6460
}

src/Forms/GridFieldPublishAction.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,7 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat
197197
/** @var \SilverStripe\ORM\DataList */
198198
$list = $gridField->getList();
199199
$item = $list->byID($arguments['RecordID']);
200-
201-
try {
202-
$item->doPublish();
203-
} catch (\Exception $e) {
204-
$item->publishRecursive();
205-
}
200+
$item->publishRecursive();
206201

207202
// output a success message to the user
208203
Controller::curr()->getResponse()->setStatusCode(

src/Forms/GridFieldUnpublishAction.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat
197197
/** @var \SilverStripe\ORM\DataList */
198198
$list = $gridField->getList();
199199
$item = $list->byID($arguments['RecordID']);
200+
201+
// We ignore this error, as the method exists in Versioned extension but
202+
// phpstan cannot verify that here.
203+
/** @phpstan-ignore method.notFound */
200204
$item->doUnpublish();
201205

202206
// output a success message to the user

src/Model/BaseItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function canDelete($member = null)
187187
}
188188

189189
if ($page = $this->getPage()) {
190-
return $page->canArchive($member);
190+
return $page->canDelete($member);
191191
}
192192

193193
return Permission::check('CMS_ACCESS', 'any', $member);

0 commit comments

Comments
 (0)