2017 © Pedro Peláez
 

library phpunit-markup-validators

HTML, CSS, and feed validation for PHPUnit

image

kevintweber/phpunit-markup-validators

HTML, CSS, and feed validation for PHPUnit

  • Sunday, March 15, 2015
  • by kevintweber
  • Repository
  • 1 Watchers
  • 3 Stars
  • 11,764 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 12 % Grown

The README.md

Markup Validation for PHPUnit

This is an extension for PHPUnit that uses online services for markup validation., (*1)

Class Validates Service
AssertHTML5 HTML5 http://html5.validator.nu/

Installation

1) Install Composer., (*2)

2) composer require kevintweber/phpunit-markup-validators
or add it to your composer.json file., (*3)

3) Install PHPUnit., (*4)

Note: I have removed PHPUnit as a composer dependency for folks who run PHPUnit globally. To install PHPUnit locally, use: composer require phpunit/phpunit, (*5)

Usage

Here is an example of a minimal test case that will pass., (*6)

<?php

require_once("vendor/autoload.php");

use Kevintweber\PhpunitMarkupValidators\Assert\AssertHtml5;

class HtmlTest extends PHPUnit_Framework_TestCase
{
    public function testHTMLValidation()
    {
        AssertHTML5::isValidMarkup("

Whoa
", "Optional custom message."); } }

Each assert class has three methods:, (*7)

1) isValidMarkup(string $markup, string $message = '', Connector $connector = null)
Passes test if $markup is valid markup., (*8)

2) isValidFile(string $pathToFile, string $message = '', Connector $connector = null)
Passes test if file at $pathToFile has valid markup., (*9)

3) isValidUrl(string $URL, string $message = '', Connector $connector = null)
Passes test if webpage at $URL has valid markup., (*10)

In the event that a test fails, first the $message will be displayed, then a detailed error report will be listed., (*11)

(The third parameter is for custom connectors, in case you want to extend this library with your own services.), (*12)

Note: Each online service requests that API usage does not exceed 1 request per second. I have included a throttle class to limit requests. An easy workaround is to not use the same test class repeatedly, but rather alternate test classes., (*13)

Authors

Kevin Weber - kevintweber@gmail.com, (*14)

License

phpunit-markup-validators is licensed under the MIT license. See LICENSE for more details., (*15)

Acknowledgements

Parts were inspired from xvoland/html-validate., (*16)

The Versions

15/03 2015

dev-master

9999999-dev https://github.com/kevintweber/phpunit-markup-validators

HTML, CSS, and feed validation for PHPUnit

  Sources   Download

MIT

The Requires

  • php >= 5.3.3

 

phpunit css validation html atom rss

15/03 2015

v2.0.0

2.0.0.0 https://github.com/kevintweber/phpunit-markup-validators

HTML, CSS, and feed validation for PHPUnit

  Sources   Download

MIT

The Requires

  • php >= 5.3.3

 

phpunit css validation html atom rss

19/01 2013

1.1.0

1.1.0.0 https://github.com/kevintweber/phpunit-markup-validators

HTML, CSS, and feed validation for PHPUnit

  Sources   Download

MIT

The Requires

  • php >= 5.3.3

 

phpunit css validation html atom rss

20/11 2012

1.0.2

1.0.2.0 https://github.com/kevintweber/phpunit-markup-validators

HTML, CSS, and feed validation for PHPUnit

  Sources   Download

MIT

The Requires

 

phpunit css validation html atom rss

19/11 2012

1.0.1

1.0.1.0 https://github.com/kevintweber/phpunit-markup-validators

HTML, CSS, and feed validation for PHPUnit

  Sources   Download

MIT

The Requires

 

phpunit css validation html atom rss

19/11 2012

1.0.0

1.0.0.0 https://github.com/kevintweber/PhpunitW3CValidators

HTML and CSS validation for PHPUnit

  Sources   Download

MIT

The Requires

 

phpunit css validation html