{"id":29270221,"url":"https://github.com/kolyunya/codeception-markup-validator","last_synced_at":"2025-07-04T22:11:23.222Z","repository":{"id":57008203,"uuid":"88342530","full_name":"Kolyunya/codeception-markup-validator","owner":"Kolyunya","description":"Markup validator module for Codeception.","archived":false,"fork":false,"pushed_at":"2023-02-12T14:29:40.000Z","size":120,"stargazers_count":13,"open_issues_count":5,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-26T14:04:40.874Z","etag":null,"topics":["acceptance-testing","codeception","codeception-module","html-validator","markup-validator","w3c-validator"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kolyunya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"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":"2017-04-15T11:23:34.000Z","updated_at":"2025-02-20T15:59:37.000Z","dependencies_parsed_at":"2024-06-21T17:53:15.172Z","dependency_job_id":null,"html_url":"https://github.com/Kolyunya/codeception-markup-validator","commit_stats":{"total_commits":83,"total_committers":2,"mean_commits":41.5,"dds":"0.10843373493975905","last_synced_commit":"47de8a3369ea0f19a05745ff60708d9273b82c9e"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/Kolyunya/codeception-markup-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolyunya%2Fcodeception-markup-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolyunya%2Fcodeception-markup-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolyunya%2Fcodeception-markup-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolyunya%2Fcodeception-markup-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kolyunya","download_url":"https://codeload.github.com/Kolyunya/codeception-markup-validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolyunya%2Fcodeception-markup-validator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263626326,"owners_count":23490624,"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":["acceptance-testing","codeception","codeception-module","html-validator","markup-validator","w3c-validator"],"created_at":"2025-07-04T22:11:20.745Z","updated_at":"2025-07-04T22:11:23.197Z","avatar_url":"https://github.com/Kolyunya.png","language":"PHP","readme":"# Codeception Markup Validator\n[![Latest Stable Version](https://poser.pugx.org/kolyunya/codeception-markup-validator/v/stable)](https://packagist.org/packages/kolyunya/codeception-markup-validator)\n[![Build Status](https://github.com/Kolyunya/codeception-markup-validator/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/Kolyunya/codeception-markup-validator/actions/workflows/build.yml)\n[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Kolyunya/codeception-markup-validator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Kolyunya/codeception-markup-validator/?branch=master)\n[![Code Climate](https://codeclimate.com/github/Kolyunya/codeception-markup-validator/badges/gpa.svg)](https://codeclimate.com/github/Kolyunya/codeception-markup-validator)\n\n## Problem\nProgrammatically validate markup of web application pages during automated acceptance testing.\n\n## Solution\nMarkup validator module for [Codeception](http://codeception.com). Validates web-pages markup (HTML, XHTML etc.) using markup validators e.g. [W3C Markup Validator Service](https://validator.w3.org/docs/api.html). Don't let invalid pages reach production. Add some zero effort tests to your acceptance suite which will immediately inform you when your markup gets broken.\n```php\n$I-\u003eamOnPage('/');\n$I-\u003evalidateMarkup();\n```\n\nDead simple to use. Requires literally no configuraton. Works as you expect it out of box. Fully configurable and extendable if you want to hack it. Each component of the module can be replaced with your custom class. Just implement a simple interface and inject custom component to the module.\n\n## Installation\nThe recommended way of module installation is via [composer](https://getcomposer.org):\n```sh\ncomposer require --dev kolyunya/codeception-markup-validator\n```\n\n## Usage\nAdd the module to your acceptance test suit configuration:\n```yaml\nclass_name: AcceptanceTester\nmodules:\n    enabled:\n        - PhpBrowser:\n            url: 'http://localhost/'\n        - Kolyunya\\Codeception\\Module\\MarkupValidator\n```\n\nBuild the test suit:\n```sh\ncodecept build\n```\n\nValidate markup:\n```php\n$I-\u003eamOnPage('/');\n$I-\u003evalidateMarkup();\n```\n\nIf you need, you may override module-wide message filter configuration for each page individually like this:\n```php\n// Perform very strict checks for this particular page.\n$I-\u003eamOnPage('/foo/');\n$I-\u003evalidateMarkup(array(\n    'ignoreWarnings' =\u003e false,\n));\n\n// Ignore those two errors just on this page.\n$I-\u003eamOnPage('/bar/');\n$I-\u003evalidateMarkup(array(\n    'ignoredErrors' =\u003e array(\n        '/some error/',\n        '/another error/',\n    ),\n));\n\n// Set error count threshold, do not ignore warnings\n// but ignore some errors on this page.\n$I-\u003eamOnPage('/quux/');\n$I-\u003evalidateMarkup(array(\n    'errorCountThreshold' =\u003e 10,\n    'ignoreWarnings' =\u003e false,\n    'ignoredErros' =\u003e array(\n        '/this error/',\n        '/that error/',\n    ),\n));\n```\n\n## Configuration\nThe module does not require any configuration. The default setup will work if you have either [`PhpBrowser`](http://codeception.com/docs/modules/PhpBrowser) or [`WebDriver`](http://codeception.com/docs/modules/WebDriver) modules enabled.\n\nNevertheless the module is fully-configurable and hackable. It consist of four major components: [`provider`](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/MarkupProviderInterface.php) which provides markup to validate, [`validator`](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/MarkupValidatorInterface.php) which performs actual markup validation, [`filter`](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/MessageFilterInterface.php) which filters messages received from the validator and  [`printer`](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/MessagePrinterInterface.php) which determines how to print messages received from the validator. You may configure each of the components with a custom implementation.\n\n### Provider\nThe module may be configured with a custom `provider` which will provide the markup to the `validator`. The [`default provider`](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/DefaultMarkupProvider.php) tries to obtain markup from the `PhpBrowser` and `WebDriver` modules.\n```yaml\nclass_name: AcceptanceTester\nmodules:\n    enabled:\n        - PhpBrowser:\n            url: 'http://localhost/'\n        - Kolyunya\\Codeception\\Module\\MarkupValidator:\n            provider:\n                class: Acme\\Tests\\Path\\To\\CustomMarkupProvider\n```\n\n### Validator\nThe module may be configured with a custom `validator` which will validate markup received from the `provider`. The [default validator](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/W3CMarkupValidator.php) uses the [W3C Markup Validation Service API](https://validator.w3.org/docs/api.html).\n```yaml\nclass_name: AcceptanceTester\nmodules:\n    enabled:\n        - PhpBrowser:\n            url: 'http://localhost/'\n        - Kolyunya\\Codeception\\Module\\MarkupValidator:\n            validator:\n                class: Acme\\Tests\\Path\\To\\CustomMarkupValidator\n```\n\n### Filter\nThe module may be configured with a custom `filter` which will filter messages received from the `validator`. You may implement you own `filter` or tweak a [default one](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/DefaultMessageFilter.php).\n```yaml\nclass_name: AcceptanceTester\nmodules:\n    enabled:\n        - PhpBrowser:\n            url: 'http://localhost/'\n        - Kolyunya\\Codeception\\Module\\MarkupValidator:\n            filter:\n                class: Kolyunya\\Codeception\\Lib\\MarkupValidator\\DefaultMessageFilter\n                config:\n                    errorCountThreshold: 10\n                    ignoreWarnings: true\n                    ignoredErrors:\n                        - '/some error/'\n                        - '/another error/'\n```\n\n### Printer\nThe module may be configured with a custom `printer` which defines how messages received from the `validator` are printed. The [default printer](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/DefaultMessagePrinter.php) prints message type, summary, details, first line number, last line number and related markup.\n```yaml\nclass_name: AcceptanceTester\nmodules:\n    enabled:\n        - PhpBrowser:\n            url: 'http://localhost/'\n        - Kolyunya\\Codeception\\Module\\MarkupValidator:\n            printer:\n                class: Acme\\Tests\\Path\\To\\CustomMessagePrinter\n```\n\n## Contributing\nIf you found a bug or have a feature request feel free to [open an issue](https://github.com/Kolyunya/codeception-markup-validator/issues/new). If you want to send a pull request, backward-compatible changes should target the `master` branch while breaking changes - the next major version branch.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkolyunya%2Fcodeception-markup-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkolyunya%2Fcodeception-markup-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkolyunya%2Fcodeception-markup-validator/lists"}