Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 39 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,45 @@
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:
- 'master'

jobs:
silverstripe-module:
name: 🧰 Silverstripe Module Testsuite
uses: syntro-opensource/workflows/.github/workflows/silverstripe-module.yml@master
silverstripe-module-6:
name: 🧰 Silverstripe Module Testsuite 6
uses: syntro-opensource/workflows/.github/workflows/silverstripe-module-6.yml@master
with:
phpunit: true
phpstan: true
phpcs: 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/
13 changes: 6 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@
}
],
"require": {
"php": "^7.4.0 || ^8",
"silverstripe/cms": "^4 || ^5",
"silverstripe/framework": "^4 || ^5",
"php": "^8",
"silverstripe/framework": "^6",
"giggsey/libphonenumber-for-php": "^8.0"
},
"require-dev": {
"silverstripe/cms": "^6",
"squizlabs/php_codesniffer": "^3.0",
"syntro/silverstripe-phpstan": "^1",
"phpunit/phpunit": "^9.4"
"cambis/silverstan": "^2.0",
"phpunit/phpunit": "^11"
},
"keywords": [
"silverstripe",
"silverstripe 4",
"frontend forms"
],
"license": "BSD-3-Clause",
Expand All @@ -40,7 +39,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
"dev-master": "6.x-dev"
}
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
includes:
- vendor/syntro/silverstripe-phpstan/phpstan.neon
- vendor/cambis/silverstan/extension.neon
29 changes: 15 additions & 14 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@

<phpunit
bootstrap="vendor/silverstripe/framework/tests/bootstrap.php"
colors="true"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnWarning="true"
colors="true"
backupGlobals="false"
backupStaticProperties="false"
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
failOnRisky="true"
failOnWarning="true"
>
<testsuite name="Default">
<directory>tests</directory>
</testsuite>
<coverage>

<source>
<include>
<directory suffix=".php">src</directory>
<directory suffix=".php">./src</directory>
</include>
<exclude>
<directory suffix=".php">vendor/</directory>
<directory suffix=".php">vendor</directory>
<directory suffix=".php">./src/Dev</directory>
</exclude>
</coverage>
</phpunit>
</source>
</phpunit>
7 changes: 6 additions & 1 deletion src/Dev/FormPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@
*/
class FormPage extends SiteTree implements TestOnly
{

/**
* Defines the database table name
* @var string
* @config
*/
private static $table_name = 'FormPage';
}
10 changes: 5 additions & 5 deletions src/Dev/FormPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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']),
Expand All @@ -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 = RequiredFieldsValidator::create(['required']);
$form = Form::create($this, 'Form', $fields, $actions, $required);

return $form;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Forms/CheckboxField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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\View\ViewableData $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)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Forms/TextareaField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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\View\ViewableData $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)
{
Expand Down