diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e9fa9a1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" + labels: + - "dependencies" + commit-message: + prefix: "chore(deps)" + target-branch: "main" diff --git a/.github/workflows/php82.yaml b/.github/workflows/php82.yaml index 978033a..7e0cbc5 100644 --- a/.github/workflows/php82.yaml +++ b/.github/workflows/php82.yaml @@ -11,7 +11,7 @@ jobs: uses: WebFiori/workflows/.github/workflows/test-php.yaml@main with: php-version: '8.2' - phpunit-config: "tests/phpunit10.xml" + phpunit-config: "tests/phpunit.xml" code-coverage: name: Coverage diff --git a/.github/workflows/php83.yaml b/.github/workflows/php83.yaml index 56bbbd1..fa7a263 100644 --- a/.github/workflows/php83.yaml +++ b/.github/workflows/php83.yaml @@ -15,7 +15,7 @@ jobs: uses: WebFiori/workflows/.github/workflows/test-php.yaml@main with: php-version: '8.3' - phpunit-config: 'tests/phpunit10.xml' + phpunit-config: 'tests/phpunit.xml' code-coverage: diff --git a/.github/workflows/php84.yaml b/.github/workflows/php84.yaml index 1ce3097..5304463 100644 --- a/.github/workflows/php84.yaml +++ b/.github/workflows/php84.yaml @@ -11,7 +11,7 @@ jobs: uses: WebFiori/workflows/.github/workflows/test-php.yaml@main with: php-version: '8.4' - phpunit-config: "tests/phpunit10.xml" + phpunit-config: "tests/phpunit.xml" code-coverage: name: Coverage diff --git a/.github/workflows/php85.yaml b/.github/workflows/php85.yaml new file mode 100644 index 0000000..4072312 --- /dev/null +++ b/.github/workflows/php85.yaml @@ -0,0 +1,28 @@ +name: Build PHP 8.5 + +on: + push: + branches: [ main ] + pull_request: + branches: [ main, dev ] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Run Tests + uses: WebFiori/workflows/.github/workflows/test-php.yaml@v1.2.5 + with: + php-version: '8.5' + phpunit-config: 'tests/phpunit.xml' + + code-coverage: + name: Coverage + needs: test + uses: WebFiori/workflows/.github/workflows/coverage-codecov.yaml@v1.2.5 + with: + php-version: '8.5' + coverage-file: 'php-8.5-coverage.xml' + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/composer.json b/composer.json index 112e6ef..fa064e0 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,6 @@ }, "scripts": { "test": "vendor/bin/phpunit -c tests/phpunit.xml", - "test10": "vendor/bin/phpunit -c tests/phpunit10.xml", "fix-cs": "vendor/bin/php-cs-fixer fix --config=php_cs.php.dist" }, "license": "MIT" diff --git a/tests/WebFiori/Tests/Ui/HTMLDocTest.php b/tests/WebFiori/Tests/Ui/HTMLDocTest.php index 43a1d43..8624b87 100644 --- a/tests/WebFiori/Tests/Ui/HTMLDocTest.php +++ b/tests/WebFiori/Tests/Ui/HTMLDocTest.php @@ -24,11 +24,10 @@ public function testgetChildrenByAttrVal00() { $this->assertEquals('a', $list->get(0)->getNodeName()); } /** - * - * @param HTMLDoc $doc - * @depends testConstructor00 + * @test */ - public function testAsCode00(HTMLDoc $doc) { + public function testAsCode00() { + $doc = new HTMLDoc(); $this->assertEquals("" ."<!DOCTYPE html>\r\n" ."<html>\r\n" @@ -167,7 +166,6 @@ public function testConstructor00() { ."\r\n" ."" ."",$doc->toHTML()); - return $doc; } /** * @test diff --git a/tests/WebFiori/Tests/Ui/HeadNodeTest.php b/tests/WebFiori/Tests/Ui/HeadNodeTest.php index 1a1783c..aafccfe 100644 --- a/tests/WebFiori/Tests/Ui/HeadNodeTest.php +++ b/tests/WebFiori/Tests/Ui/HeadNodeTest.php @@ -85,10 +85,11 @@ public function testQuotedAttribute00() { } /** * @test - * @depends testAddMeta02 - * @param HeadNode $headNode D */ - public function getMetaTest00($headNode) { + public function getMetaTest00() { + $headNode = new HeadNode(); + $headNode->addMeta('description', 'Page Description.'); + $headNode->addMeta('description', 'Hello', true); $metas = $headNode->getMetaNodes(); $this->assertEquals(2,count($metas)); $meta00 = $metas->get(0); @@ -282,7 +283,6 @@ public function testAddCss00() { } /** * @test - * @depends testAddCss00 */ public function testAddCss01() { $node = new HeadNode(); @@ -304,12 +304,9 @@ public function testAddCss01() { 'revision' => true ]); $this->assertEquals(3, $node->getCSSNodes()->size()); - - return $node; } /** * @test - * @depends testAddCss00 */ public function testAddCss02() { $node = new HeadNode(); @@ -404,7 +401,6 @@ public function testAddJs00() { } /** * @test - * @depends testAddJs00 */ public function testAddJs01() { $node = new HeadNode(); @@ -424,8 +420,6 @@ public function testAddJs01() { 'revision' => true ]); $this->assertEquals(3, $node->getJSNodes()->size()); - - return $node; } public function testAddJs02() { $node = new HeadNode(); @@ -570,8 +564,6 @@ public function testAddMeta02() { $node->addMeta('description', 'Hello',true); $meta = $node->getMeta('description'); $this->assertEquals('Hello',$meta->getAttributeValue('content')); - - return $node; } /** * @test @@ -670,9 +662,18 @@ public function testGetJsNodes00() { } /** * @test - * @depends testAddCss01 */ - public function testHasCss00($node) { + public function testHasCss00() { + $node = new HeadNode(); + $node->addCSS('https://example.com/css1?hello=true', [ + 'revision' => true + ]) + ->addCSS('https://example.com/css2 ? hello=true', [ + 'revision' => true + ]); + $node->addCSS('https://example.com/css3?', [ + 'revision' => true + ]); $this->assertTrue($node->hasCss('https://example.com/css1')); $this->assertTrue($node->hasCss('https://example.com/css1?something=x')); $this->assertTrue($node->hasCss('https://example.com/css2')); @@ -682,9 +683,18 @@ public function testHasCss00($node) { } /** * @test - * @depends testAddJs01 */ - public function testHasJs00($node) { + public function testHasJs00() { + $node = new HeadNode(); + $node->addJs('https://example.com/js1?hello=true', [ + 'revision' => true + ]); + $node->addJs('https://example.com/js2 ? hello=true', [ + 'revision' => true + ]); + $node->addJs('https://example.com/js3?', [ + 'revision' => true + ]); $this->assertTrue($node->hasJs('https://example.com/js1')); $this->assertTrue($node->hasJs('https://example.com/js1?something=x')); $this->assertTrue($node->hasJs('https://example.com/js2')); diff --git a/tests/WebFiori/Tests/Ui/InputTest.php b/tests/WebFiori/Tests/Ui/InputTest.php index 5f10a6b..431b17b 100644 --- a/tests/WebFiori/Tests/Ui/InputTest.php +++ b/tests/WebFiori/Tests/Ui/InputTest.php @@ -12,10 +12,9 @@ class InputTest extends TestCase { /** * @test - * @depends testConstructor00 - * @param Input $inputEl */ - public function setTypeTest00($inputEl) { + public function setTypeTest00() { + $inputEl = new Input(); $inputEl->setType('file'); $this->assertEquals('file',$inputEl->getType()); $inputEl->setType(' Date'); @@ -28,10 +27,9 @@ public function setTypeTest00($inputEl) { } /** * @test - * @depends testConstructor01 - * @param Input $inputEl */ - public function setTypeTest01($inputEl) { + public function setTypeTest01() { + $inputEl = new Input('textarea'); $inputEl->setType('file'); $this->assertNull($inputEl->getType()); $inputEl->setType(' Date'); @@ -44,10 +42,9 @@ public function setTypeTest01($inputEl) { } /** * @test - * @depends testConstructor02 - * @param Input $inputEl */ - public function setTypeTest02($inputEl) { + public function setTypeTest02() { + $inputEl = new Input('select'); $inputEl->setType('file'); $this->assertNull($inputEl->getType()); $inputEl->setType(' Date'); @@ -244,8 +241,6 @@ public function testConstructor00() { $this->assertEquals('input',$inputEl->getNodeName()); $this->assertEquals('text',$inputEl->getType()); $this->assertFalse($inputEl->setNodeName('')); - - return $inputEl; } /** * @@ -255,8 +250,6 @@ public function testConstructor01() { $inputEl = new Input('textarea'); $this->assertEquals('textarea',$inputEl->getNodeName()); $this->assertNull($inputEl->getType()); - - return $inputEl; } /** * @@ -266,8 +259,6 @@ public function testConstructor02() { $inputEl = new Input('select'); $this->assertEquals('select',$inputEl->getNodeName()); $this->assertNull($inputEl->getType()); - - return $inputEl; } /** * @@ -277,8 +268,6 @@ public function testConstructor03() { $inputEl = new Input('ghfhfhg'); $this->assertEquals('input',$inputEl->getNodeName()); $this->assertEquals('text',$inputEl->getType()); - - return $inputEl; } /** * @test @@ -303,8 +292,6 @@ public function testSetPlaceHolder02() { $input = new Input('textarea'); $input->setPlaceholder('Enter your suggestions here.'); $this->assertEquals('',$input->toHTML()); - - return $input; } /** * @test @@ -316,10 +303,10 @@ public function testSetPlaceHolder03() { } /** * @test - * @depends testSetPlaceHolder02 - * @param Input $input Description */ - public function testSetPlaceHolder04($input) { + public function testSetPlaceHolder04() { + $input = new Input('textarea'); + $input->setPlaceholder('Enter your suggestions here.'); $input->setPlaceholder(null); $this->assertNull($input->getAttribute('placeholder')); } diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 656b9bb..fef0805 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -1,23 +1,26 @@ - - + + + + + + + - - - ../WebFiori/Ui/HTMLNode.php - ../WebFiori/Ui/HeadNode.php - ../WebFiori/Ui/HTMLDoc.php - ../WebFiori/Ui/Input.php - ../WebFiori/Ui/HTMLTable.php - ../WebFiori/Ui/TemplateCompiler.php - - - - - - - - ./WebFiori/Tests/Ui - - - \ No newline at end of file + + + + ./WebFiori/Tests/Ui + + + + + ../WebFiori/Ui/HTMLNode.php + ../WebFiori/Ui/HeadNode.php + ../WebFiori/Ui/HTMLDoc.php + ../WebFiori/Ui/Input.php + ../WebFiori/Ui/HTMLTable.php + ../WebFiori/Ui/TemplateCompiler.php + + + diff --git a/tests/phpunit10.xml b/tests/phpunit10.xml deleted file mode 100644 index fef0805..0000000 --- a/tests/phpunit10.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - ./WebFiori/Tests/Ui - - - - - ../WebFiori/Ui/HTMLNode.php - ../WebFiori/Ui/HeadNode.php - ../WebFiori/Ui/HTMLDoc.php - ../WebFiori/Ui/Input.php - ../WebFiori/Ui/HTMLTable.php - ../WebFiori/Ui/TemplateCompiler.php - - -