Skip to content
Snippets Groups Projects
Commit a7b3041a authored by Laurent's avatar Laurent
Browse files

tests: assertHTML5: w3c validator url can be configured with...

tests: assertHTML5: w3c validator url can be configured with BOKEH_HTML_VALIDATOR_URL environment variable
parent 3843b16e
2 merge requests!2080Sandbox detach zf from storm,!2061Master
Pipeline #8 failed with stage
in 5 seconds
......@@ -235,19 +235,26 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe
if ($content == null)
$content = $this->_response->getBody();
$httpClient = (new Zend_Http_Client('http://sandbox.pergame.net/html-validator/'))
if (!$nu_validator_url = getenv('BOKEH_HTML_VALIDATOR_URL'))
$nu_validator_url ='https://validator.w3.org/nu/';
$httpClient = (new Zend_Http_Client($nu_validator_url))
->setMethod(Zend_Http_Client::POST)
->setHeaders('Content-Type', 'text/html; charset=utf-8')
->setEncType(Zend_Http_Client::ENC_FORMDATA)
->setParameterPost('content', $content);
->setParameterGet('out', 'text')
->setRawData($content);
$response = $httpClient->request()->getBody();
$content_lines = explode("\n", $content);
$content_with_lines = "HTML:\n";
$content_with_lines = "HTML from: " . $nu_validator_url ."\n";
foreach($content_lines as $i => $line) {
$content_with_lines .= sprintf("%4s %s\n", $i + 1, $line);
}
$this->assertContains('No errors found', $response, $content_with_lines);
$this->assertNotContains('Error: ',
$response,
$content_with_lines);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment