From f26cd7045e863c3f1a0e2ad7d41495721159fb70 Mon Sep 17 00:00:00 2001 From: Derek Stephen McLean Date: Sun, 31 Mar 2024 15:25:11 +0200 Subject: [PATCH] update to codecept 5 --- .github/workflows/master.yml | 13 ++++++----- .scrutinizer.yml | 2 ++ .travis.yml | 23 ------------------- codeception.yml | 18 +++++---------- composer.json | 10 ++++---- src/FormInterface.php | 4 ++-- tests/unit/Del/DynamicFormTest.php | 6 ++--- tests/unit/Del/Field/CheckboxTest.php | 6 ++--- tests/unit/Del/Field/FileUploadTest.php | 6 ++--- tests/unit/Del/Field/FloatTest.php | 6 ++--- tests/unit/Del/Field/HiddenTest.php | 6 ++--- tests/unit/Del/Field/IntegerTest.php | 6 ++--- tests/unit/Del/Field/MultiSelectTest.php | 4 ++-- tests/unit/Del/Field/RadioTest.php | 6 ++--- tests/unit/Del/Field/SelectTest.php | 6 ++--- tests/unit/Del/Field/TextAreaTest.php | 6 ++--- tests/unit/Del/Field/TextTest.php | 6 ++--- .../Transformer/DateTimeTransformerTest.php | 4 ++-- tests/unit/Del/FormTest.php | 4 ++-- .../Renderer/HorizontalFormRendererTest.php | 4 ++-- .../Validator/FileExtensionValidatorTest.php | 6 ++--- .../unit/Del/Validator/FloatValidatorTest.php | 6 ++--- .../Del/Validator/MimeTypeValidatorTest.php | 6 ++--- 23 files changed, 69 insertions(+), 95 deletions(-) delete mode 100755 .travis.yml diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 6544907..139d535 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -11,11 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: - - 7.3 - - 7.4 - - 8.0 - - 8.1 + php: ['8.2', '8.3'] steps: - uses: actions/checkout@v2 with: @@ -33,6 +29,11 @@ jobs: restore-keys: | ${{ runner.os }}-php- + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - name: Install dependencies run: composer install --prefer-dist --no-progress @@ -40,7 +41,7 @@ jobs: run: XDEBUG_MODE=coverage vendor/bin/codecept run unit --coverage-xml - name: Download Scrutinizer ocular.phar - run: composer require scrutinizer/ocular + run: composer require scrutinizer/ocular -W - name: Upload coverage run: vendor/bin/ocular code-coverage:upload --format=php-clover tests/_output/coverage.xml diff --git a/.scrutinizer.yml b/.scrutinizer.yml index a073f37..1368e64 100755 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -6,6 +6,8 @@ build: tests: override: - php-scrutinizer-run + environment: + php: 8.2.14 filter: paths: - src/* diff --git a/.travis.yml b/.travis.yml deleted file mode 100755 index 0cb8d9c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: php - -php: - - 7.3 - - 7.4 - - 8.0 - - 8.1 - -addons: - hosts: - - blank - -sudo: false - -install: - - composer install - -script: - - php vendor/bin/codecept run unit --coverage-xml --env travis - -after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml diff --git a/codeception.yml b/codeception.yml index 402be29..46689d4 100755 --- a/codeception.yml +++ b/codeception.yml @@ -1,21 +1,15 @@ -actor: Tester +actor_suffix: Tester paths: tests: tests - log: tests/_output + output: tests/_output data: tests/_data helpers: tests/_support -bootstrap: unit/_bootstrap.php +bootstrap: _bootstrap.php settings: colors: true memory_limit: 1024M -modules: - config: - Db: - dsn: '' - user: '' - password: '' - dump: tests/_data/dump.sql coverage: enabled: true - include: - - src/* \ No newline at end of file + whitelist: + include: + - src/*.php diff --git a/composer.json b/composer.json index 4308dbe..00b14d5 100755 --- a/composer.json +++ b/composer.json @@ -9,16 +9,16 @@ } ], "require": { - "php": ">=7.3", + "php": "^8.2", "ext-dom": "*", "ext-fileinfo": "*", - "laminas/laminas-validator": "^2.8", - "laminas/laminas-filter": "^2.9" + "laminas/laminas-validator": "^2.52", + "laminas/laminas-filter": "^2.34" }, "require-dev": { "roave/security-advisories": "dev-master", - "codeception/codeception": "^4.1", - "codeception/module-asserts": "^1.1" + "codeception/codeception": "^5.1", + "codeception/module-asserts": "^3.0" }, "autoload": { "psr-4": { diff --git a/src/FormInterface.php b/src/FormInterface.php index efa7131..9ac3f96 100644 --- a/src/FormInterface.php +++ b/src/FormInterface.php @@ -105,7 +105,7 @@ public function getAttribute(string $key); * @param mixed $value * @return $this */ - public function setAttribute(string $key, $value): void; + public function setAttribute(string $key, mixed $value): void; /** * @param array $attributes @@ -127,4 +127,4 @@ public function isDisplayErrors(): bool; * @return AbstractForm */ public function setDisplayErrors(bool $displayErrors): void; -} \ No newline at end of file +} diff --git a/tests/unit/Del/DynamicFormTest.php b/tests/unit/Del/DynamicFormTest.php index 43eb45d..859ffd5 100644 --- a/tests/unit/Del/DynamicFormTest.php +++ b/tests/unit/Del/DynamicFormTest.php @@ -2,14 +2,14 @@ namespace DelTesting\Form; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Field\Radio; use Del\Form\Field\Submit; use Del\Form\Field\Text; use Del\Form\Form; use Del\Form\Renderer\HorizontalFormRenderer; -class DynamicFormTest extends Test +class DynamicFormTest extends Unit { public function testGetDynamicFormFieldThrowsException() { @@ -151,4 +151,4 @@ private function getForm() return $form; } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Field/CheckboxTest.php b/tests/unit/Del/Field/CheckboxTest.php index cd56654..4b43c0c 100644 --- a/tests/unit/Del/Field/CheckboxTest.php +++ b/tests/unit/Del/Field/CheckboxTest.php @@ -2,7 +2,7 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Field\CheckBox; use Del\Form\Field\Text; use Del\Form\Form; @@ -13,7 +13,7 @@ * Date: 05/12/2016 * Time: 02:27 */ -class CheckboxTest extends Test +class CheckboxTest extends Unit { public function testMultipleCheckBoxsInHorizontalForm() { @@ -173,4 +173,4 @@ public function testEmptyCheckbox() $form->populate([]); $this->assertFalse($form->isValid()); } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Field/FileUploadTest.php b/tests/unit/Del/Field/FileUploadTest.php index 28cb4d6..9d4bdf1 100644 --- a/tests/unit/Del/Field/FileUploadTest.php +++ b/tests/unit/Del/Field/FileUploadTest.php @@ -2,7 +2,7 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Field\Text; use Del\Form\Form; use Del\Form\Field\FileUpload; @@ -14,7 +14,7 @@ * Date: 05/12/2016 * Time: 02:27 */ -class FileUploadTest extends Test +class FileUploadTest extends Unit { public function testRendererThrowsException() { @@ -157,4 +157,4 @@ public function testSetUploadDirectoryThrowsException() $this->expectException('InvalidArgumentException'); $pic->setUploadDirectory($image); } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Field/FloatTest.php b/tests/unit/Del/Field/FloatTest.php index 79f3d65..e590633 100644 --- a/tests/unit/Del/Field/FloatTest.php +++ b/tests/unit/Del/Field/FloatTest.php @@ -2,11 +2,11 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Field\Text\FloatingPoint; use Del\Form\Form; -class FloatTest extends Test +class FloatTest extends Unit { public function testRequiredField() { @@ -20,4 +20,4 @@ public function testRequiredField() $this->assertFalse($float->isValid()); } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Field/HiddenTest.php b/tests/unit/Del/Field/HiddenTest.php index b3e4ee2..ddea952 100644 --- a/tests/unit/Del/Field/HiddenTest.php +++ b/tests/unit/Del/Field/HiddenTest.php @@ -2,7 +2,7 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Form; use Del\Form\Field\Hidden; @@ -11,7 +11,7 @@ * Date: 05/12/2016 * Time: 02:27 */ -class HiddenTest extends Test +class HiddenTest extends Unit { public function testRequiredField() { @@ -23,4 +23,4 @@ public function testRequiredField() $this->assertEquals('
'."\n", $html); } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Field/IntegerTest.php b/tests/unit/Del/Field/IntegerTest.php index 838c60f..708f928 100644 --- a/tests/unit/Del/Field/IntegerTest.php +++ b/tests/unit/Del/Field/IntegerTest.php @@ -2,11 +2,11 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Field\Text\Integer; use Del\Form\Form; -class IntegerTest extends Test +class IntegerTest extends Unit { public function testRequiredField() { @@ -22,4 +22,4 @@ public function testRequiredField() $this->assertFalse($form->isValid()); } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Field/MultiSelectTest.php b/tests/unit/Del/Field/MultiSelectTest.php index 46ad247..a0c2208 100644 --- a/tests/unit/Del/Field/MultiSelectTest.php +++ b/tests/unit/Del/Field/MultiSelectTest.php @@ -2,14 +2,14 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Field\MultiSelect; use Del\Form\Field\Submit; use Del\Form\Field\Text; use Del\Form\Form; use Del\Form\Renderer\Field\SelectRender; -class MultiSelectTest extends Test +class MultiSelectTest extends Unit { public function testSelect() { diff --git a/tests/unit/Del/Field/RadioTest.php b/tests/unit/Del/Field/RadioTest.php index 82e09c5..2283736 100644 --- a/tests/unit/Del/Field/RadioTest.php +++ b/tests/unit/Del/Field/RadioTest.php @@ -2,7 +2,7 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Field\Radio; use Del\Form\Field\Text; use Del\Form\Form; @@ -13,7 +13,7 @@ * Date: 05/12/2016 * Time: 02:27 */ -class RadioTest extends Test +class RadioTest extends Unit { public function testRadio() { @@ -122,4 +122,4 @@ public function testRenderRadioWithValue() $html = $form->render(); $this->assertEquals('
'."\n", $html); } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Field/SelectTest.php b/tests/unit/Del/Field/SelectTest.php index 9929d0d..c007929 100644 --- a/tests/unit/Del/Field/SelectTest.php +++ b/tests/unit/Del/Field/SelectTest.php @@ -2,7 +2,7 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Field\Submit; use Del\Form\Field\Text; use Del\Form\Field\Select; @@ -14,7 +14,7 @@ * Date: 05/12/2016 * Time: 02:27 */ -class SelectTest extends Test +class SelectTest extends Unit { public function testSelect() { @@ -76,4 +76,4 @@ public function testRenderSelectWithValue() $html = $form->render(); $this->assertEquals('
'."\n", $html); } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Field/TextAreaTest.php b/tests/unit/Del/Field/TextAreaTest.php index 5683f83..304b527 100644 --- a/tests/unit/Del/Field/TextAreaTest.php +++ b/tests/unit/Del/Field/TextAreaTest.php @@ -2,7 +2,7 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Form; use Del\Form\Field\TextArea; @@ -11,7 +11,7 @@ * Date: 05/12/2016 * Time: 02:27 */ -class TextAreaTest extends Test +class TextAreaTest extends Unit { public function testRenderTextArea() @@ -25,4 +25,4 @@ public function testRenderTextArea() $this->assertEquals('Type something..', $text->getPlaceholder()); $this->assertEquals('
'."\n", $html); } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Field/TextTest.php b/tests/unit/Del/Field/TextTest.php index 00bd722..7f2f7c9 100644 --- a/tests/unit/Del/Field/TextTest.php +++ b/tests/unit/Del/Field/TextTest.php @@ -2,7 +2,7 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Form; use Del\Form\Field\Text; @@ -11,7 +11,7 @@ * Date: 05/12/2016 * Time: 02:27 */ -class TextTest extends Test +class TextTest extends Unit { public function testRequiredField() { @@ -27,4 +27,4 @@ public function testRequiredField() $this->assertTrue($form->isValid()); } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Field/Transformer/DateTimeTransformerTest.php b/tests/unit/Del/Field/Transformer/DateTimeTransformerTest.php index bf02a13..ff30601 100644 --- a/tests/unit/Del/Field/Transformer/DateTimeTransformerTest.php +++ b/tests/unit/Del/Field/Transformer/DateTimeTransformerTest.php @@ -2,13 +2,13 @@ namespace DelTesting\Form\Field\Transformer; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use DateTime; use Del\Form\Field\Transformer\DateTimeTransformer; use Del\Form\Form; use Del\Form\Field\Text; -class DateTimeTransformerTest extends Test +class DateTimeTransformerTest extends Unit { public function testPlainText() { diff --git a/tests/unit/Del/FormTest.php b/tests/unit/Del/FormTest.php index 99512aa..bddcac6 100755 --- a/tests/unit/Del/FormTest.php +++ b/tests/unit/Del/FormTest.php @@ -2,7 +2,7 @@ namespace DelTesting\Form; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Collection\FilterCollection; use Del\Form\Collection\ValidatorCollection; use Del\Form\Form; @@ -20,7 +20,7 @@ use Laminas\Validator\NotEmpty; use Laminas\Validator\StringLength; -class FormTest extends Test +class FormTest extends Unit { /** * @var \UnitTester diff --git a/tests/unit/Del/Renderer/HorizontalFormRendererTest.php b/tests/unit/Del/Renderer/HorizontalFormRendererTest.php index d8af657..6263022 100755 --- a/tests/unit/Del/Renderer/HorizontalFormRendererTest.php +++ b/tests/unit/Del/Renderer/HorizontalFormRendererTest.php @@ -2,7 +2,7 @@ namespace DelTesting\Form\Renderer; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Form; use Del\Form\Renderer; @@ -12,7 +12,7 @@ use Del\Form\Field\Submit; use Del\Form\Field\Text; -class HorizontalFormRendererTest extends Test +class HorizontalFormRendererTest extends Unit { /** * @var \UnitTester diff --git a/tests/unit/Del/Validator/FileExtensionValidatorTest.php b/tests/unit/Del/Validator/FileExtensionValidatorTest.php index b3a2c45..b9f7586 100644 --- a/tests/unit/Del/Validator/FileExtensionValidatorTest.php +++ b/tests/unit/Del/Validator/FileExtensionValidatorTest.php @@ -2,10 +2,10 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Validator\FileExtensionValidator; -class FileExtensionValidatorTest extends Test +class FileExtensionValidatorTest extends Unit { public function testFileExtensionValidation() { @@ -22,4 +22,4 @@ public function testFileExtensionValidation() $this->assertFalse($validator->isValid('photo.xml')); $this->assertEquals('The file must be either a png or jpg file.', $validator->getMessages()[0]); } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Validator/FloatValidatorTest.php b/tests/unit/Del/Validator/FloatValidatorTest.php index cb71f55..8e91a19 100644 --- a/tests/unit/Del/Validator/FloatValidatorTest.php +++ b/tests/unit/Del/Validator/FloatValidatorTest.php @@ -2,7 +2,7 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Validator\FloatValidator; /** @@ -10,7 +10,7 @@ * Date: 05/12/2016 * Time: 02:27 */ -class FloatValidatorTest extends Test +class FloatValidatorTest extends Unit { public function testFloatValidation() { @@ -22,4 +22,4 @@ public function testFloatValidation() $this->assertFalse($validator->isValid('hello')); $this->assertEquals('Value is not a float.', $validator->getMessages()[0]); } -} \ No newline at end of file +} diff --git a/tests/unit/Del/Validator/MimeTypeValidatorTest.php b/tests/unit/Del/Validator/MimeTypeValidatorTest.php index c0380f8..d67329c 100644 --- a/tests/unit/Del/Validator/MimeTypeValidatorTest.php +++ b/tests/unit/Del/Validator/MimeTypeValidatorTest.php @@ -2,10 +2,10 @@ namespace DelTesting\Form\Field; -use Codeception\TestCase\Test; +use Codeception\Test\Unit; use Del\Form\Validator\MimeTypeValidator; -class MimeTypeValidatorTest extends Test +class MimeTypeValidatorTest extends Unit { public function testMimeValidation() { @@ -25,4 +25,4 @@ public function testMimeValidation() $this->assertFalse($validator->isValid('form.png')); $this->assertEquals('Invalid mime type.', $validator->getMessages()[0]); } -} \ No newline at end of file +}