PHP code example of webignition / html-validation-error-normaliser

1. Go to this page and download the library: Download webignition/html-validation-error-normaliser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webignition / html-validation-error-normaliser example snippets




use webignition\HtmlValidationErrorNormaliser\HtmlValidationErrorNormaliser;

class ExampleTest extends \PHPUnit_Framework_TestCase {    

    protected function testDemonstrateNormaliser() {
        $htmlErrorString = 'document type does not allow element "style" here';  
        $normaliser = new HtmlValidationErrorNormaliser();        
        
        $this->assertEquals(
            'document type does not allow element "%0" here',
            $normaliser->normalise($htmlErrorString)->getNormalisedError()->getNormalForm()
        );
        
        $this->assertEquals(
            array('style'),
            $normaliser->normalise($htmlErrorString)->getNormalisedError()->getParameters()
        );        
    }
    
}