src/Kevintweber/PhpunitMarkupValidators/Assert/AssertHTML5.php
public static function isValidFile($path,
                                       $message = '',
                                       ConnectorInterface $connector = null)
    {
        // Check that $path is exists.
        if (!file_exists($path)) {
            throw new \PHPUnit_Framework_Exception(
                sprintf('File "%s" does not exist.'."\n", $path)
            );
        }

        // Get file contents.
        $html = file_get_contents($path);
        if ($html === false) {
            throw new \PHPUnit_Framework_Exception(
                sprintf('Cannot read file "%s".'."\n", $path)
            );
        }

        // Assign connector if there isn't one already.
        if ($connector === null) {
            $connector = new HTML5ValidatorNuConnector();
        }

        // Parse the html.
        $connector->setInput($html);
        $response = $connector->execute('file');

        // Tell PHPUnit of the results.
        $constraint = new GenericConstraint($connector);
        self::assertThat($response, $constraint, $message);
    }
public static function isValidFile($path,
                                       $message = '',
                                       ConnectorInterface $connector = null)
    {
        // Check that $path is exists.
        if (!file_exists($path)) {
            throw new \PHPUnit_Framework_Exception(
                sprintf('File "%s" does not exist.'."\n", $path)
            );
        }

        // Get file contents.
        $html = file_get_contents($path);
        if ($html === false) {
            throw new \PHPUnit_Framework_Exception(
                sprintf('Cannot read file "%s".'."\n", $path)
            );
        }

        // Assign connector if there isn't one already.
        if ($connector === null) {
            $connector = new HTML5ValidatorNuConnector();
        }

        // Parse the html.
        $connector->setInput($html);
        $response = $connector->execute('file');

        // Tell PHPUnit of the results.
        $constraint = new GenericConstraint($connector);
        self::assertThat($response, $constraint, $message);
    }
public static function isValidFile ( $ path , $ message = '' , ConnectorInterface $ connector = null ) { // Check that $path is exists. if ( ! file_exists ( $ path ) ) { throw new \ PHPUnit_Framework_Exception ( sprintf ( 'File "%s" does not exist.' . "\n" , $ path ) ) ; } // Get file contents. $ html = file_get_contents ( $ path ) ; if ( $ html === false ) { throw new \ PHPUnit_Framework_Exception ( sprintf ( 'Cannot read file "%s".' . "\n" , $ path ) ) ; } // Assign connector if there isn't one already. if ( $ connector === null ) { $ connector = new HTML5ValidatorNuConnector ( ) ; } // Parse the html. $ connector -> setInput ( $ html ) ; $ response = $ connector -> execute ( 'file' ) ; // Tell PHPUnit of the results. $ constraint = new GenericConstraint ( $ connector ) ; self :: assertThat ( $ response , $ constraint , $ message ) ; }
Asserts that the HTML5 file is valid.

@param string             $path      The file path to be validated.
@param string             $message   Test message.
@param ConnectorInterface $connector Connector to HTML5 validation service.
Asserts that the HTML5 file is valid .