Recommend this page to a friend! |
Download .zip |
Info | Documentation | Screenshots | View files (8) | Download .zip | Reputation | Support forum | Blog (1) | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2021-08-04 (1 month ago) | Not yet rated by the users | Total: 81 This week: 2 | All time: 9,723 This week: 88 |
Version | License | PHP version | Categories | |||
htmltestcase 1.0 | GNU General Publi... | 7 | HTML, Testing, PHP 7 |
Very often the main purpose of a PHP package is to generate any specific HTML code. This extension of the existing base class can mainly be used for the automated testing of such packages with PHPUnit.
In addition to numerous methods with which the presence or the content of certain tags, elements or attributes within an HTML block can be checked, the package also offers the possibility of checking an HTML document or block as a whole for its validity. (validates for W3C - HTML5)
This validation is done with a cURL request to the REST API from The Nu Html Checker that is reachable at https://html5.validator.nu.
As a small addition, a text can be checked to ensure that it does not contain any HTML tags
This package contains a class that extends the PHPUnit TestCase
class to perform
HTML test for multiple purposes:
It supports several methods to test/assert for - valid HTML5 document/block - existing HTML tag/element/attribute - HTML tag/element/attribute value equals expected - HTML tag/element/attribute contains expected part - HTML tag/element has requested style set to expected value - given text is plain text (means, text doesn't contain any HTML tags)
A full class reference can be found here.
The class is designed for use with the Version 9 of PHPUnit and to do the cURL request for HTML validation, the PHP libraries cURL and OpenSSL are required.
You can integrate the source file HtmlTestCase.php
into your own PHPUnit
Test-infrastructure (you may have to rename or change the namespace) or use it as it is.
The only change to your own test code is to use the HtmlTestCase
class instead of
TestCase
as the base class for your test cases. The phpunit.xml
is an example
configuration that calls the tests from the ExampleTest
directory.
This testcase contains two tests for each assertion-method of the package. The first of each is passed successful, the second one fails so you can see the generated error messages.
Screenshots | ||
Files |
File | Role | Description | ||
---|---|---|---|---|
ExampleTest (1 file) | ||||
SKien (1 directory) | ||||
autoloader.php | Aux. | Auxiliary script | ||
HtmlTestCase.md | Doc. | Documentation of a test case | ||
HtmlTestCaseReference.html | Doc. | Documentation | ||
LICENSE | Lic. | License text | ||
phpunit.xml | Data | Auxiliary data | ||
readme.md | Doc. | Documentation |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.