{"id":19526331,"url":"https://github.com/phpfui/htmlunittester","last_synced_at":"2025-04-26T10:31:10.739Z","repository":{"id":52243815,"uuid":"206853251","full_name":"phpfui/HTMLUnitTester","owner":"phpfui","description":"PHPUnit Testing extensions for HMTL and CSS","archived":false,"fork":false,"pushed_at":"2024-12-26T22:59:07.000Z","size":62,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T16:49:21.378Z","etag":null,"topics":["css","html","phpunit"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phpfui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-06T18:35:01.000Z","updated_at":"2024-12-26T22:59:10.000Z","dependencies_parsed_at":"2023-11-23T15:27:28.144Z","dependency_job_id":"72b7cc01-63d9-431c-bb58-75069341f4be","html_url":"https://github.com/phpfui/HTMLUnitTester","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpfui%2FHTMLUnitTester","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpfui%2FHTMLUnitTester/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpfui%2FHTMLUnitTester/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpfui%2FHTMLUnitTester/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpfui","download_url":"https://codeload.github.com/phpfui/HTMLUnitTester/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250972714,"owners_count":21516413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css","html","phpunit"],"created_at":"2024-11-11T01:09:33.539Z","updated_at":"2025-04-26T10:31:10.529Z","avatar_url":"https://github.com/phpfui.png","language":"PHP","readme":"# PHPFUI\\HTMLUnitTester [![Tests](https://github.com/phpfui/HTMLUnitTester/actions/workflows/tests.yml/badge.svg)](https://github.com/phpfui/HTMLUnitTester/actions?query=workflow%3Atests) [![Latest Packagist release](https://img.shields.io/packagist/v/phpfui/html-unit-tester.svg)](https://packagist.org/packages/phpfui/html-unit-tester) ![](https://img.shields.io/badge/PHPStan-level%206-brightgreen.svg?style=flat)\n\n[PHPUnit](https://phpunit.de/) Testing extensions for HMTL and CSS. **PHPFUI\\HTMLUnitTester** allows you to unit test HTML and CSS for errors and warnings. Often simple errors in HTML or CSS create hard to debug issues where a simple check will reveal bad code.\n\nThis package will check detect errors and warnings in HTML and CSS in stand alone strings, files, entire directories or urls.\n\nFor the best performanance, a local install of [https://github.com/validator/validator](https://github.com/validator/validator) is recommended.\n## Installation\n```\ncomposer require phpfui/html-unit-tester\n```\n## Configuration\nIt is recommended you run [https://github.com/validator/validator](https://github.com/validator/validator) locally. Install [Java](https://www.java.com/ES/download/) and download the [.jar file](https://github.com/validator/validator/releases). Run with the following command:\n```\njava -Xss1024k -Dnu.validator.servlet.bind-address=127.0.0.1 -cp .\\vnu.jar nu.validator.servlet.Main 8888\n```\nTo run unit tests with GitHub Actions, add the following lines to you workflows test yml file:\n```\n- name: Setup Java\n\tuses: actions/setup-java@v3\n\twith:\n\t\tdistribution: 'temurin'\n\t\tjava-version: '11'\n\n- name: Download vnu checker\n\trun: wget https://github.com/validator/validator/releases/download/latest/vnu.jar\n\n- name: Run Nu Html Checker (v.Nu)\n\trun: java -cp vnu.jar -Xss1024k -Dnu.validator.servlet.bind-address=127.0.0.1 nu.validator.servlet.Main 8888 \u0026\n```\n## Usage\nExtend your unit tests from \\PHPFUI\\HTMLUnitTester\\Extensions\n```php\nclass UnitTest extends \\PHPFUI\\HTMLUnitTester\\Extensions\n  {\n  public function testValidHtml()\n    {\n    $this-\u003eassertValidHtml('\u003ch1\u003eHeader\u003c/h1\u003e');\n    $this-\u003eassertValidHtmlPage('\u003c!DOCTYPE html\u003e\u003chtml\u003e\u003chead\u003e\u003cmeta charset=\"utf-8\"/\u003e\u003ctitle\u003eTitle\u003c/title\u003e\u003c/head\u003e\u003cbody\u003e\u003cdiv\u003eThis is a test\u003c/div\u003e\u003c/body\u003e\u003c/html\u003e');\n    }\n  }\n```\nYou can use any of the following asserts:\n- assertNotWarningCss\n- assertNotWarningCssFile\n- assertNotWarningCssUrl\n- assertNotWarningFile\n- assertNotWarningHtml\n- assertNotWarningHtmlPage\n- assertNotWarningUrl\n- assertValidCss\n- assertValidCssFile\n- assertValidCssUrl\n- assertValidFile\n- assertValidHtml\n- assertValidHtmlPage\n- assertValidUrl\n\n## Directory Testing\nInstead of file by file testing, use **assertDirectory** to test an entire directory. Any files added to the directory will be automatically tested.\n```php\n  $this-\u003eassertDirectory('ValidCSS', 'cssDirectory', 'Invalid CSS');\n  $this-\u003eassertDirectory('NotWarningCSS', 'cssDirectory', 'CSS has warnings');\n```\nThe error message will include the offending file name.\n\n## Examples\nSee [examples](https://github.com/phpfui/HTMLUnitTester/blob/master/tests/UnitTest.php)\n\n## Documentation\n\nFull documentation at [PHPFUI\\HTMLUnitTester](http://phpfui.com/?p=d\u0026n=PHPFUI%5CHTMLUnitTester)\n\n## License\nPHPFUI\\HTMLUnitTester is distributed under the MIT License.\n\n### PHP Versions\nThis library only supports **modern** versions of PHP which still receive security updates. While we would love to support PHP from the late Ming Dynasty, the advantages of modern PHP versions far out weigh quaint notions of backward compatibility. Time to upgrade.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpfui%2Fhtmlunittester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpfui%2Fhtmlunittester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpfui%2Fhtmlunittester/lists"}