for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the hogosha-monitor package
*
* Copyright (c) 2016 Guillaume Cavana
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* Feel free to edit as you please, and have fun.
* @author Guillaume Cavana <[email protected]>
*/
namespace Hogosha\Monitor\Validator;
/**
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');