for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Hogosha\Monitor\Validator;
/**
* @author Guillaume Cavana <[email protected]>
*/
class XmlValidatorTest extends \PHPUnit_Framework_TestCase
{
protected $xml;
public function setUp()
$this->xml = <<<XML
<?xml version="1.0"?>
<root>
<name>chuck</name>
<lastname>norris</lastname>
</root>
XML;
}
* testCheckTrue
public function testCheckTrue()
$xmlValidator = new XmlValidator();
$this->assertNull($xmlValidator->check($this->xml, '//name'));
* testException
* @expectedException Hogosha\Monitor\Exception\ValidatorException
* @expectedExceptionMessage this node "//nickname" does not exist
public function testException()
$xmlValidator->check($this->xml, '//nickname');
* testInvalidXml
* @expectedExceptionMessage This xml is not valid
public function testInvalidXml()
$xmlValidator->check('<xml></xml', '//nickanme');