Source for file URIValidationTest.php
Documentation is available at URIValidationTest.php
* This file tests the validation of the web accessible URIs.
require_once 'Services/W3C/HTMLValidator.php';
require_once 'PHPUnit/Framework.php';
// Call Services_W3C_HTMLValidatorTest::main() if executed directly.
if (!defined("PHPUnit_MAIN_METHOD")) {
define("PHPUnit_MAIN_METHOD", "URIValidationTest::main");
class URIValidationTest extends PHPUnit_Framework_TestCase
public $uri = 'http://www.unl.edu/';
* Runs the test methods of this class.
public static function main ()
include_once "PHPUnit/TextUI/TestRunner.php";
$suite = new PHPUnit_Framework_TestSuite ("URIValidationTest");
$result = PHPUnit_TextUI_TestRunner ::run ($suite);
public function testURI ()
$r = $this->validator->validate ($this->uri);
$this->assertEquals (get_class($r), 'Services_W3C_HTMLValidator_Response');
$message = $this->constructErrorMessage ($r);
$message = $r->uri. ' is Valid';
$this->assertTrue ($r->isValid (), $message);
public function testFile ()
$r = $this->validator->validate ($this->uri);
$this->assertEquals (get_class($r), 'Services_W3C_HTMLValidator_Response');
$message = $this->constructErrorMessage ($r);
$message = $r->uri. ' is Valid';
$this->assertTrue ($r->isValid (), $message);
protected function constructErrorMessage (&$r)
$message = $r->uri. ' is NOT VALID: '. count($r->errors ). ' Errors -'.PHP_EOL;
foreach ($r->errors as $error) {
$message .= ' - '. $error->message.PHP_EOL;
// Call Services_W3C_HTMLValidatorTest::main() if file is executed directly.
URIValidationTest ::main ();
Documentation generated on Mon, 11 Mar 2019 15:37:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|