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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
labels:
- "dependencies"
commit-message:
prefix: "chore(deps)"
target-branch: "main"
2 changes: 1 addition & 1 deletion .github/workflows/php82.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php83.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php84.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/php85.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 3 additions & 5 deletions tests/WebFiori/Tests/Ui/HTMLDocTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -167,7 +166,6 @@ public function testConstructor00() {
."</html>\r\n"
.""
."",$doc->toHTML());
return $doc;
}
/**
* @test
Expand Down
42 changes: 26 additions & 16 deletions tests/WebFiori/Tests/Ui/HeadNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -282,7 +283,6 @@ public function testAddCss00() {
}
/**
* @test
* @depends testAddCss00
*/
public function testAddCss01() {
$node = new HeadNode();
Expand All @@ -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();
Expand Down Expand Up @@ -404,7 +401,6 @@ public function testAddJs00() {
}
/**
* @test
* @depends testAddJs00
*/
public function testAddJs01() {
$node = new HeadNode();
Expand All @@ -424,8 +420,6 @@ public function testAddJs01() {
'revision' => true
]);
$this->assertEquals(3, $node->getJSNodes()->size());

return $node;
}
public function testAddJs02() {
$node = new HeadNode();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'));
Expand All @@ -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'));
Expand Down
31 changes: 9 additions & 22 deletions tests/WebFiori/Tests/Ui/InputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand Down Expand Up @@ -244,8 +241,6 @@ public function testConstructor00() {
$this->assertEquals('input',$inputEl->getNodeName());
$this->assertEquals('text',$inputEl->getType());
$this->assertFalse($inputEl->setNodeName(''));

return $inputEl;
}
/**
*
Expand All @@ -255,8 +250,6 @@ public function testConstructor01() {
$inputEl = new Input('textarea');
$this->assertEquals('textarea',$inputEl->getNodeName());
$this->assertNull($inputEl->getType());

return $inputEl;
}
/**
*
Expand All @@ -266,8 +259,6 @@ public function testConstructor02() {
$inputEl = new Input('select');
$this->assertEquals('select',$inputEl->getNodeName());
$this->assertNull($inputEl->getType());

return $inputEl;
}
/**
*
Expand All @@ -277,8 +268,6 @@ public function testConstructor03() {
$inputEl = new Input('ghfhfhg');
$this->assertEquals('input',$inputEl->getNodeName());
$this->assertEquals('text',$inputEl->getType());

return $inputEl;
}
/**
* @test
Expand All @@ -303,8 +292,6 @@ public function testSetPlaceHolder02() {
$input = new Input('textarea');
$input->setPlaceholder('Enter your suggestions here.');
$this->assertEquals('<textarea placeholder="Enter your suggestions here."></textarea>',$input->toHTML());

return $input;
}
/**
* @test
Expand All @@ -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'));
}
Expand Down
45 changes: 24 additions & 21 deletions tests/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="bootstrap.php">
<php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache">
<coverage includeUncoveredFiles="true">
<report>
<clover outputFile="clover.xml"/>
</report>
</coverage>
<php>
</php>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<file>../WebFiori/Ui/HTMLNode.php</file>
<file>../WebFiori/Ui/HeadNode.php</file>
<file>../WebFiori/Ui/HTMLDoc.php</file>
<file>../WebFiori/Ui/Input.php</file>
<file>../WebFiori/Ui/HTMLTable.php</file>
<file>../WebFiori/Ui/TemplateCompiler.php</file>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="clover.xml"/>
</logging>
<testsuites>
<testsuite name="HTML Elements Tests">
<directory>./WebFiori/Tests/Ui</directory>
</testsuite>
</testsuites>
</phpunit>
<logging/>
<testsuites>
<testsuite name="HTML Elements Tests">
<directory>./WebFiori/Tests/Ui</directory>
</testsuite>
</testsuites>
<source>
<include>
<file>../WebFiori/Ui/HTMLNode.php</file>
<file>../WebFiori/Ui/HeadNode.php</file>
<file>../WebFiori/Ui/HTMLDoc.php</file>
<file>../WebFiori/Ui/Input.php</file>
<file>../WebFiori/Ui/HTMLTable.php</file>
<file>../WebFiori/Ui/TemplateCompiler.php</file>
</include>
</source>
</phpunit>
26 changes: 0 additions & 26 deletions tests/phpunit10.xml

This file was deleted.

Loading