Skip to content

Commit

Permalink
update to codecept 5
Browse files Browse the repository at this point in the history
  • Loading branch information
delboy1978uk committed Mar 31, 2024
1 parent aa10529 commit f26cd70
Show file tree
Hide file tree
Showing 23 changed files with 69 additions and 95 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -33,14 +29,19 @@ 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

- name: Run test suite with coverage
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
2 changes: 2 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ build:
tests:
override:
- php-scrutinizer-run
environment:
php: 8.2.14
filter:
paths:
- src/*
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

18 changes: 6 additions & 12 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -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/*
whitelist:
include:
- src/*.php
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/FormInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -127,4 +127,4 @@ public function isDisplayErrors(): bool;
* @return AbstractForm
*/
public function setDisplayErrors(bool $displayErrors): void;
}
}
6 changes: 3 additions & 3 deletions tests/unit/Del/DynamicFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -151,4 +151,4 @@ private function getForm()

return $form;
}
}
}
6 changes: 3 additions & 3 deletions tests/unit/Del/Field/CheckboxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -13,7 +13,7 @@
* Date: 05/12/2016
* Time: 02:27
*/
class CheckboxTest extends Test
class CheckboxTest extends Unit
{
public function testMultipleCheckBoxsInHorizontalForm()
{
Expand Down Expand Up @@ -173,4 +173,4 @@ public function testEmptyCheckbox()
$form->populate([]);
$this->assertFalse($form->isValid());
}
}
}
6 changes: 3 additions & 3 deletions tests/unit/Del/Field/FileUploadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -14,7 +14,7 @@
* Date: 05/12/2016
* Time: 02:27
*/
class FileUploadTest extends Test
class FileUploadTest extends Unit
{
public function testRendererThrowsException()
{
Expand Down Expand Up @@ -157,4 +157,4 @@ public function testSetUploadDirectoryThrowsException()
$this->expectException('InvalidArgumentException');
$pic->setUploadDirectory($image);
}
}
}
6 changes: 3 additions & 3 deletions tests/unit/Del/Field/FloatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -20,4 +20,4 @@ public function testRequiredField()
$this->assertFalse($float->isValid());

}
}
}
6 changes: 3 additions & 3 deletions tests/unit/Del/Field/HiddenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -11,7 +11,7 @@
* Date: 05/12/2016
* Time: 02:27
*/
class HiddenTest extends Test
class HiddenTest extends Unit
{
public function testRequiredField()
{
Expand All @@ -23,4 +23,4 @@ public function testRequiredField()
$this->assertEquals('<form name="required-text-form" method="post" id="required-text-form"><div class="form-group" id="secret-form-group"><label for=""></label><input name="secret" type="hidden" class="form-control" value="hahaha"></div></form>'."\n", $html);

}
}
}
6 changes: 3 additions & 3 deletions tests/unit/Del/Field/IntegerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -22,4 +22,4 @@ public function testRequiredField()
$this->assertFalse($form->isValid());

}
}
}
4 changes: 2 additions & 2 deletions tests/unit/Del/Field/MultiSelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/Del/Field/RadioTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -13,7 +13,7 @@
* Date: 05/12/2016
* Time: 02:27
*/
class RadioTest extends Test
class RadioTest extends Unit
{
public function testRadio()
{
Expand Down Expand Up @@ -122,4 +122,4 @@ public function testRenderRadioWithValue()
$html = $form->render();
$this->assertEquals('<form name="choose" method="post" id="choose"><div class="form-group" id="selection-form-group"><label for=""></label><div class="form-check"><input class="form-check-input" type="radio" name="selection" value="MCD"><label for="1" class="form-check-label">McDonalds</label></div><div class="form-check"><input class="form-check-input" type="radio" name="selection" value="BK"><label for="2" class="form-check-label">Burger King</label></div><div class="form-check"><input class="form-check-input" type="radio" name="selection" value="Q" checked><label for="3" class="form-check-label">Quick</label></div></div></form>'."\n", $html);
}
}
}
6 changes: 3 additions & 3 deletions tests/unit/Del/Field/SelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -14,7 +14,7 @@
* Date: 05/12/2016
* Time: 02:27
*/
class SelectTest extends Test
class SelectTest extends Unit
{
public function testSelect()
{
Expand Down Expand Up @@ -76,4 +76,4 @@ public function testRenderSelectWithValue()
$html = $form->render();
$this->assertEquals('<form name="choose" method="post" id="choose"><div class="form-group" id="selection-form-group"><label for=""></label><select name="selection" type="text" class="form-control" value="Q"><option value="MCD">McDonalds</option><option value="BK">Burger King</option><option value="Q" selected>Quick</option></select></div><div class="form-group" id="submit-form-group"><label for=""></label><input name="submit" value="submit" type="submit" class="btn btn-primary"></div></form>'."\n", $html);
}
}
}
6 changes: 3 additions & 3 deletions tests/unit/Del/Field/TextAreaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -11,7 +11,7 @@
* Date: 05/12/2016
* Time: 02:27
*/
class TextAreaTest extends Test
class TextAreaTest extends Unit
{

public function testRenderTextArea()
Expand All @@ -25,4 +25,4 @@ public function testRenderTextArea()
$this->assertEquals('Type something..', $text->getPlaceholder());
$this->assertEquals('<form name="required-text-form" method="post" id="required-text-form"><div class="form-group" id="text-form-group"><label for=""></label><textarea name="text" class="form-control" placeholder="Type something..">hello</textarea></div></form>'."\n", $html);
}
}
}
6 changes: 3 additions & 3 deletions tests/unit/Del/Field/TextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -11,7 +11,7 @@
* Date: 05/12/2016
* Time: 02:27
*/
class TextTest extends Test
class TextTest extends Unit
{
public function testRequiredField()
{
Expand All @@ -27,4 +27,4 @@ public function testRequiredField()
$this->assertTrue($form->isValid());

}
}
}
Loading

0 comments on commit f26cd70

Please sign in to comment.