src/Kevintweber/PhpunitMarkupValidators/Assert/AssertHTML5.php
public static function isValidMarkup($html,
                                         $message = '',
                                         ConnectorInterface $connector = null)
    {
        // Check that $html is a string.
        if (empty($html) || !is_string($html)) {
            throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
        }

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

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

        // Tell PHPUnit of the results.
        $constraint = new GenericConstraint($connector);
        self::assertThat($response, $constraint, $message);
    }
public static function isValidMarkup($html,
                                         $message = '',
                                         ConnectorInterface $connector = null)
    {
        // Check that $html is a string.
        if (empty($html) || !is_string($html)) {
            throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
        }

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

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

        // Tell PHPUnit of the results.
        $constraint = new GenericConstraint($connector);
        self::assertThat($response, $constraint, $message);
    }
public static function isValidMarkup ( $ html , $ message = '' , ConnectorInterface $ connector = null ) { // Check that $html is a string. if ( empty ( $ html ) || ! is_string ( $ html ) ) { throw \ PHPUnit_Util_InvalidArgumentHelper :: factory ( 1 , 'string' ) ; } // Assign connector if there isn't one already. if ( $ connector === null ) { $ connector = new HTML5ValidatorNuConnector ( ) ; } // Validate the html. $ connector -> setInput ( $ html ) ; $ response = $ connector -> execute ( 'markup' ) ; // Tell PHPUnit of the results. $ constraint = new GenericConstraint ( $ connector ) ; self :: assertThat ( $ response , $ constraint , $ message ) ; }
Asserts that the HTML5 string is valid.

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