Recommend this page to a friend! |
Classes of Stefan Kientzler | PHP HTML Test Case | HtmlTestCase.md | Download |
|
Download <a name="htmltestcase"></a> Class HtmlTestCaseFull name:??? \SKien\Test\HtmlTestCase Base class:??? \PHPUnit\Framework\TestCaseExtension of PHPUnit Testcase for HTML testing. This class 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 - given text is plain text (means, text doesn't contain any HTML tags) <b>To test for valid HTML5 doc/block the PHP libraries cURL and OpenSSL required.</b> Overview| Method | Description | |:--- |:--- | | assertContainsNoHtmlTag |Assert that the given text don't contain any HTML tags (-> contains plain text).| | assertHtmlElementAttribContains |Assert that the given HTML string contains element with requested ID and specified attrib containing expected part.| | assertHtmlElementAttribEquals |Assert that the given HTML string contains element with requested ID and specified attrib having expected value.| | assertHtmlElementContains |Assert that the given HTML string contains element with requested ID containing expected part.| | assertHtmlElementEquals |Assert that the given HTML string contains element with requested ID and expected value.| | assertHtmlElementHasAttrib |Assert that the given HTML string contains element with requested ID and specified attrib.| | assertHtmlElementHasStyle |Assert that the given HTML string contains element with requested ID and specified style having expected value.| | assertHtmlHasElement |Assert that the given HTML string contains element with requested ID.| | assertHtmlHasTag |Assert that the given HTML string contains the requested tag.| | assertHtmlTagAttribContains |Assert that the given HTML string contains the requested tag with specified attrib containing expected part.| | assertHtmlTagAttribEquals |Assert that the given HTML string contains the requested tag with specified attrib having expected value.| | assertHtmlTagContains |Assert that the given HTML string contains the requested tag containing expected part.| | assertHtmlTagEquals |Assert that the given HTML string contains the requested tag with expected value.| | assertHtmlTagHasAttrib |Assert that the given HTML string contains the requested tag with specified attrib.| | assertHtmlTagHasStyle |Assert that the given HTML string contains the requested tag with specified style having expected value.| | assertValidHtml |Assert that the given string is a valid HTML5 document.| | assertValidHtmlBlock |Assert that the given string is a valid HTML5 block.| MethodsassertContainsNoHtmlTagAssert that the given text don't contain any HTML tags (-> contains plain text).
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlElementAttribContainsAssert that the given HTML string contains element with requested ID and specified attrib containing expected part.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlElementAttribEqualsAssert that the given HTML string contains element with requested ID and specified attrib having expected value.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlElementContainsAssert that the given HTML string contains element with requested ID containing expected part.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlElementEqualsAssert that the given HTML string contains element with requested ID and expected value.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlElementHasAttribAssert that the given HTML string contains element with requested ID and specified attrib.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlElementHasStyleAssert that the given HTML string contains element with requested ID and specified style having expected value.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlHasElementAssert that the given HTML string contains element with requested ID.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlHasTagAssert that the given HTML string contains the requested tag.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlTagAttribContainsAssert that the given HTML string contains the requested tag with specified attrib containing expected part.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlTagAttribEqualsAssert that the given HTML string contains the requested tag with specified attrib having expected value.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlTagContainsAssert that the given HTML string contains the requested tag containing expected part.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlTagEqualsAssert that the given HTML string contains the requested tag with expected value.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlTagHasAttribAssert that the given HTML string contains the requested tag with specified attrib.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertHtmlTagHasStyleAssert that the given HTML string contains the requested tag with specified style having expected value.
Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertValidHtmlAssert that the given string is a valid HTML5 document.
Calls https://html5.validator.nu through cURL request. More info can be found on https://github.com/validator/validator/wiki/Service-%C2%BB-HTTP-interface Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) assertValidHtmlBlockAssert that the given string is a valid HTML5 block.
The HTML block is enclosed in a valid HTML5 Document definition before validation. Parameters: | Parameter | Type | Description |
|-----------|------|-------------|
| [[go to top]](#htmltestcase) |