From e7383d89ad447d5234a54e12b5e1e02940fde302 Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Wed, 29 Jan 2025 17:45:54 +0100 Subject: [PATCH 01/14] remove: CMS is no longer a required dependency --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 494b260..fc8eb79 100644 --- a/composer.json +++ b/composer.json @@ -10,11 +10,11 @@ ], "require": { "php": "^7.4.0 || ^8", - "silverstripe/cms": "^4 || ^5", "silverstripe/framework": "^4 || ^5", "giggsey/libphonenumber-for-php": "^8.0" }, "require-dev": { + "silverstripe/cms": "^4 || ^5", "squizlabs/php_codesniffer": "^3.0", "syntro/silverstripe-phpstan": "^1", "phpunit/phpunit": "^9.4" From 0277398294c93e4c52684c9d87e0ef574e4fe48c Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 11:10:48 +0100 Subject: [PATCH 02/14] add: Silverstripe 6 Support --- .github/workflows/tests.yml | 55 ++++++++++++++++++++++++++++++------- composer.json | 11 ++++---- 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d29f886..f008920 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,16 +1,51 @@ name: 🎭 Tests on: - - push -env: - DB: MYSQL - PDO: 1 - SS_ENVIRONMENT_TYPE: "dev" - RECIPE_CMS_VERSION: 4.x-dev + push: + paths-ignore: + - .chglog/** + - .github/** + - '!.github/workflows/tests.yml' + - .editorconfig + - .gitattributes + - .gitignore + - .htaccess + - '**.md' + branches: + - 'master' + pull_request: + paths-ignore: + - .chglog/** + - .github/** + - '!.github/workflows/tests.yml' + - .editorconfig + - .gitattributes + - .gitignore + - .htaccess + - '**.md' + branches: + - '6' + jobs: - silverstripe-module: - name: 🧰 Silverstripe Module Testsuite - uses: syntro-opensource/workflows/.github/workflows/silverstripe-module.yml@master + silverstripe-module-5: + name: 🧰 Silverstripe Module Testsuite 5 + uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-5.yml@master with: phpunit: true phpstan: true - phpcs: true + silverstripe-module-6: + name: 🧰 Silverstripe Module Testsuite 6 + uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-6.yml@master + with: + phpunit: true + phpstan: true + silverstripe-module-codecoverage: + name: 📊 Silverstripe Code Coverage + uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-codecoverage.yml@master + with: + php_version: 8.3 + silverstripe_version: 6.0 + silverstripe-phpcs: + name: 🧹 Silverstripe PHPCS + uses: syntro-opensource/workflows/.github/workflows/silverstripe-phpcs.yml@master + with: + dir: src/ diff --git a/composer.json b/composer.json index fc8eb79..2d30bea 100644 --- a/composer.json +++ b/composer.json @@ -9,19 +9,18 @@ } ], "require": { - "php": "^7.4.0 || ^8", - "silverstripe/framework": "^4 || ^5", + "php": "^8", + "silverstripe/framework": "^5 || ^6", "giggsey/libphonenumber-for-php": "^8.0" }, "require-dev": { - "silverstripe/cms": "^4 || ^5", + "silverstripe/cms": "^5 || ^6", "squizlabs/php_codesniffer": "^3.0", - "syntro/silverstripe-phpstan": "^1", - "phpunit/phpunit": "^9.4" + "cambis/silverstan": "^2.0", + "phpunit/phpunit": "^11.0" }, "keywords": [ "silverstripe", - "silverstripe 4", "frontend forms" ], "license": "BSD-3-Clause", From b78d84812ee8c35957dfc76515ae010153879d0a Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 11:11:57 +0100 Subject: [PATCH 03/14] fix: master used for PRs --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f008920..af34130 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,7 +23,7 @@ on: - .htaccess - '**.md' branches: - - '6' + - 'master' jobs: silverstripe-module-5: From 4289546b8b742891bf61c71ea6caeea98245c55a Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 11:13:47 +0100 Subject: [PATCH 04/14] fix: phpunit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2d30bea..64e4be6 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "silverstripe/cms": "^5 || ^6", "squizlabs/php_codesniffer": "^3.0", "cambis/silverstan": "^2.0", - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^10.0" }, "keywords": [ "silverstripe", From b458721560009144c87507a7c67a7c35001fad33 Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 11:21:00 +0100 Subject: [PATCH 05/14] =?UTF-8?q?fix=20=F0=9F=92=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index af34130..2725c9c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -43,7 +43,7 @@ jobs: uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-codecoverage.yml@master with: php_version: 8.3 - silverstripe_version: 6.0 + silverstripe_version: 6.1 silverstripe-phpcs: name: 🧹 Silverstripe PHPCS uses: syntro-opensource/workflows/.github/workflows/silverstripe-phpcs.yml@master diff --git a/composer.json b/composer.json index 64e4be6..31a20a3 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "silverstripe/cms": "^5 || ^6", "squizlabs/php_codesniffer": "^3.0", "cambis/silverstan": "^2.0", - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^9.4" }, "keywords": [ "silverstripe", From dc1a7a50b78c087c22407cd111679ff80edbf09b Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 11:24:16 +0100 Subject: [PATCH 06/14] fix phpstan --- phpstan.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 7417811..5265314 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,2 +1,2 @@ includes: - - vendor/syntro/silverstripe-phpstan/phpstan.neon + - vendor/cambis/silverstan/extension.neon From a88eab064d26b887b5f66007f95151b65526c184 Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 11:26:45 +0100 Subject: [PATCH 07/14] make phpunit resolve --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 31a20a3..adf03a6 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "silverstripe/cms": "^5 || ^6", "squizlabs/php_codesniffer": "^3.0", "cambis/silverstan": "^2.0", - "phpunit/phpunit": "^9.4" + "phpunit/phpunit": "^9.4 || ^10" }, "keywords": [ "silverstripe", From c93ba63040173ac4a317ff920349b3592382595c Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 11:28:46 +0100 Subject: [PATCH 08/14] resolve phpunit... --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index adf03a6..75bc4d3 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "silverstripe/cms": "^5 || ^6", "squizlabs/php_codesniffer": "^3.0", "cambis/silverstan": "^2.0", - "phpunit/phpunit": "^9.4 || ^10" + "phpunit/phpunit": "^9.4 || ^11" }, "keywords": [ "silverstripe", From 5a2d7673190e5fb32173af98b07474abc61eaf0b Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 11:33:11 +0100 Subject: [PATCH 09/14] fix stan --- src/Dev/FormPage.php | 7 ++++++- src/Dev/FormPageController.php | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Dev/FormPage.php b/src/Dev/FormPage.php index 9308524..2513555 100644 --- a/src/Dev/FormPage.php +++ b/src/Dev/FormPage.php @@ -11,5 +11,10 @@ */ class FormPage extends SiteTree implements TestOnly { - + /** + * Defines the database table name + * @var string + * @config + */ + private static $table_name = 'FormPage'; } diff --git a/src/Dev/FormPageController.php b/src/Dev/FormPageController.php index bfb30ef..6a611c8 100644 --- a/src/Dev/FormPageController.php +++ b/src/Dev/FormPageController.php @@ -41,7 +41,7 @@ class FormPageController extends ContentController implements TestOnly */ public function Form() { - $fields = new FieldList( + $fields = FieldList::create( $checkboxfield = CheckboxField::create('checkboxfield', 'checkboxfield'), $checkboxsetfield = CheckboxSetField::create('checkboxsetfield', 'checkboxsetfield', ['a' => 'value a', 'b' => 'value b']), $dropdownfield = DropdownField::create('dropdownfield', 'dropdownfield', ['a' => 'value a', 'b' => 'value b']), @@ -63,9 +63,9 @@ public function Form() $textareafield->addHolderClass('textareafieldholderclass')->addExtraClass('textareafieldextraclass'); $textfield->addHolderClass('textfieldholderclass')->addExtraClass('textfieldextraclass'); - $actions = new FieldList(FormAction::create('submit', 'Submit')); - $required = new RequiredFields('required'); - $form = new Form($this, 'Form', $fields, $actions, $required); + $actions = FieldList::create(FormAction::create('submit', 'Submit')); + $required = RequiredFields::create('required'); + $form = Form::create($this, 'Form', $fields, $actions, $required); return $form; } From df634e7b388ae183b7ac700663e92244a9629f9b Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 11:56:03 +0100 Subject: [PATCH 10/14] only use SS 6 --- .github/workflows/tests.yml | 6 ------ composer.json | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2725c9c..e7bee0c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,12 +26,6 @@ on: - 'master' jobs: - silverstripe-module-5: - name: 🧰 Silverstripe Module Testsuite 5 - uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-5.yml@master - with: - phpunit: true - phpstan: true silverstripe-module-6: name: 🧰 Silverstripe Module Testsuite 6 uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-6.yml@master diff --git a/composer.json b/composer.json index 75bc4d3..e8b6e00 100644 --- a/composer.json +++ b/composer.json @@ -10,14 +10,14 @@ ], "require": { "php": "^8", - "silverstripe/framework": "^5 || ^6", + "silverstripe/framework": "^6", "giggsey/libphonenumber-for-php": "^8.0" }, "require-dev": { - "silverstripe/cms": "^5 || ^6", + "silverstripe/cms": "^6", "squizlabs/php_codesniffer": "^3.0", "cambis/silverstan": "^2.0", - "phpunit/phpunit": "^9.4 || ^11" + "phpunit/phpunit": "^11" }, "keywords": [ "silverstripe", @@ -39,7 +39,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "6.x-dev" } }, "config": { From 6f52af8a11153d3a3075872a4762f284984d4498 Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 12:00:39 +0100 Subject: [PATCH 11/14] stan again --- src/Dev/FormPageController.php | 4 ++-- src/Forms/CheckboxField.php | 2 +- src/Forms/TextareaField.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Dev/FormPageController.php b/src/Dev/FormPageController.php index 6a611c8..7111cc8 100644 --- a/src/Dev/FormPageController.php +++ b/src/Dev/FormPageController.php @@ -7,7 +7,7 @@ use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; use SilverStripe\Forms\FormAction; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; use Syntro\SilverstripeBootstrapForms\Forms\CheckboxField; use Syntro\SilverstripeBootstrapForms\Forms\CheckboxSetField; use Syntro\SilverstripeBootstrapForms\Forms\DropdownField; @@ -64,7 +64,7 @@ public function Form() $textfield->addHolderClass('textfieldholderclass')->addExtraClass('textfieldextraclass'); $actions = FieldList::create(FormAction::create('submit', 'Submit')); - $required = RequiredFields::create('required'); + $required = RequiredFieldsValidator::create(['required']); $form = Form::create($this, 'Form', $fields, $actions, $required); return $form; diff --git a/src/Forms/CheckboxField.php b/src/Forms/CheckboxField.php index 1723ff5..493e8bf 100644 --- a/src/Forms/CheckboxField.php +++ b/src/Forms/CheckboxField.php @@ -29,7 +29,7 @@ class CheckboxField extends BackendCheckboxField * Creates a new field. * * @param string $name The internal field name, passed to forms. - * @param null|string|\SilverStripe\View\ViewableData $title The human-readable field label. + * @param null|string|\SilverStripe\Model\ModelData $title The human-readable field label. * @param mixed $value The value of the field. */ function __construct($name, $title = null, $value = null) diff --git a/src/Forms/TextareaField.php b/src/Forms/TextareaField.php index 0dbe58c..b3d6884 100644 --- a/src/Forms/TextareaField.php +++ b/src/Forms/TextareaField.php @@ -19,7 +19,7 @@ class TextareaField extends BackendTextareaField * Creates a new field. * * @param string $name The internal field name, passed to forms. - * @param null|string|\SilverStripe\View\ViewableData $title The human-readable field label. + * @param null|string|\SilverStripe\Model\ModelData $title The human-readable field label. * @param mixed $value The value of the field. */ function __construct($name, $title = null, $value = null) From eadf8ab26f267088adf4647cf5810c26a840a7f5 Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 12:01:34 +0100 Subject: [PATCH 12/14] cs --- src/Forms/CheckboxField.php | 6 +++--- src/Forms/TextareaField.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Forms/CheckboxField.php b/src/Forms/CheckboxField.php index 493e8bf..bf1d36d 100644 --- a/src/Forms/CheckboxField.php +++ b/src/Forms/CheckboxField.php @@ -28,9 +28,9 @@ class CheckboxField extends BackendCheckboxField /** * Creates a new field. * - * @param string $name The internal field name, passed to forms. - * @param null|string|\SilverStripe\Model\ModelData $title The human-readable field label. - * @param mixed $value The value of the field. + * @param string $name The internal field name, passed to forms. + * @param null|string|\SilverStripe\Model\ModelData $title The human-readable field label. + * @param mixed $value The value of the field. */ function __construct($name, $title = null, $value = null) { diff --git a/src/Forms/TextareaField.php b/src/Forms/TextareaField.php index b3d6884..70c0f9e 100644 --- a/src/Forms/TextareaField.php +++ b/src/Forms/TextareaField.php @@ -18,9 +18,9 @@ class TextareaField extends BackendTextareaField /** * Creates a new field. * - * @param string $name The internal field name, passed to forms. - * @param null|string|\SilverStripe\Model\ModelData $title The human-readable field label. - * @param mixed $value The value of the field. + * @param string $name The internal field name, passed to forms. + * @param null|string|\SilverStripe\Model\ModelData $title The human-readable field label. + * @param mixed $value The value of the field. */ function __construct($name, $title = null, $value = null) { From 93e13dd5c493d6ebc87a3f5be17442b319e542fe Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 12:10:45 +0100 Subject: [PATCH 13/14] use 6.0 for coverage --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e7bee0c..ac36110 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,7 +37,7 @@ jobs: uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-codecoverage.yml@master with: php_version: 8.3 - silverstripe_version: 6.1 + silverstripe_version: 6.0 silverstripe-phpcs: name: 🧹 Silverstripe PHPCS uses: syntro-opensource/workflows/.github/workflows/silverstripe-phpcs.yml@master From 5b640fed41cdcff10030bd8229fabf13b62589d8 Mon Sep 17 00:00:00 2001 From: Matthias Leutenegger Date: Tue, 28 Oct 2025 14:11:08 +0100 Subject: [PATCH 14/14] update phpunit --- phpunit.xml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 43e228a..269edf4 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,25 +1,26 @@ tests - + + - src + ./src - vendor/ + vendor + ./src/Dev - - + + \ No newline at end of file