for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Fwk\Xml;
/**
* Test class for XmlFile.
* Generated by PHPUnit on 2012-07-25 at 22:30:05.
*/
class XmlFileTest extends \PHPUnit_Framework_TestCase {
* @var XmlFile
protected $object;
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
protected function setUp() {
$this->object = new XmlFile(__DIR__.'/not-exist.xml');
}
public function testExists() {
$this->assertFalse($this->object->exists());
public function testOpenException() {
$this->setExpectedException('\Fwk\Xml\Exceptions\FileNotFoundException');
$this->object->open();
public function testIsDirectoryException() {
$this->setExpectedException('\InvalidArgumentException');
$this->object = new XmlFile(__DIR__);
public function testGet()
{
$this->object = new XmlFile(__DIR__ .'/test.xml');
$this->assertInstanceOf('\SimpleXMLElement', $this->object->__get('test'));
public function testBogusXml() {
$this->object = new XmlFile(__DIR__ .'/test-bogus.xml');
$this->setExpectedException('\Fwk\Xml\Exceptions\XmlErrorException');