Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove unserializer

  • Loading branch information...
commit ba27b68e0f896b928e4ccd789579409bb2348cb1 1 parent 52c9729
Frank Kleine authored
424 src/main/php/net/stubbles/xml/unserializer/XmlUnserializer.php
View
@@ -1,424 +0,0 @@
-<?php
-/**
- * This file is part of stubbles.
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * @package net\stubbles\xml
- */
-namespace net\stubbles\xml\unserializer;
-use net\stubbles\lang\BaseObject;
-use net\stubbles\lang\exception\FileNotFoundException;
-use net\stubbles\xml\XmlException;
-/**
- * Class to read XML files and turn them into simple PHP types.
- */
-class XmlUnserializer extends BaseObject
-{
- /**
- * current options for the serialization
- *
- * @type array
- */
- protected $options = array();
- /**
- * current depth within the parsed document
- *
- * @type int
- */
- protected $depth = 0;
- /**
- * stack of opened elements while parsing
- *
- * @type array
- */
- protected $dataStack = array();
- /**
- * value stack
- *
- * @type array
- */
- protected $valueStack = array();
-
- /**
- * constructor
- *
- * @param array $options
- */
- public function __construct(array $options = null)
- {
- if (null === $options) {
- $this->options = XmlUnserializerOption::getDefault();
- } else {
- $this->options = array_merge(XmlUnserializerOption::getDefault(), $options);
- }
- }
-
- /**
- * unserializes data from given file
- *
- * @param string $fileName
- * @return mixed
- * @throws FileNotFoundException
- * @throws XmlException
- */
- public function unserializeFile($fileName)
- {
- if (!file_exists($fileName)) {
- throw new FileNotFoundException($fileName);
- }
-
- $reader = $this->initParser();
- if (!$reader->open($fileName, $this->options[XmlUnserializerOption::ENCODING_SOURCE])) {
- throw new XmlException('Failed to unserialize contents of ' . $fileName . ', can not create XML reader for given file.');
- }
-
- $result = $this->parse($reader);
- $reader->close($fileName);
- return $result;
- }
-
- /**
- * unserialize data
- *
- * @param string $data data to unserialize
- * @return mixed
- * @throws XmlException
- */
- public function unserialize($data)
- {
- $reader = $this->initParser();
- if (!$reader->xml($data, $this->options[XmlUnserializerOption::ENCODING_SOURCE])) {
- throw new XmlException('Failed to unserialize data, can not create XML reader for given data.');
- }
-
- return $this->parse($reader);
- }
-
- /**
- * parses the xml document and creates the data structure from it
- *
- * @param \XMLReader $reader
- * @return mixed
- */
- protected function parse(\XMLReader $reader)
- {
- $data = null;
- while ($reader->read()) {
- switch ($reader->nodeType) {
- case \XMLReader::ELEMENT:
- $empty = $reader->isEmptyElement;
- $nameSpaceURI = $reader->namespaceURI;
- $elementName = $reader->localName;
- $attributes = array();
- if (true == $reader->hasAttributes) {
- // go to first attribute
- $attribute = $reader->moveToFirstAttribute();
- // save data of all attributes
- while (true == $attribute) {
- $attributes[$reader->localName] = $reader->value;
- $attribute = $reader->moveToNextAttribute();
- }
- }
-
- $this->startElement($nameSpaceURI, $elementName, $attributes);
- if (true === $empty) {
- $data = $this->endElement($nameSpaceURI, $elementName);
- }
- break;
-
- case \XMLReader::TEXT:
- case \XMLReader::CDATA:
- $this->characters($reader->value);
- break;
-
- case \XMLReader::END_ELEMENT:
- $data = $this->endElement($reader->namespaceURI, $reader->localName);
- break;
-
- default:
- // intentionally empty
- }
- }
-
- return $data;
- }
-
- /**
- * initializes the parser
- *
- * @return \XMLReader $reader
- */
- protected function initParser()
- {
- return new \XMLReader();
- }
-
- /**
- * handles the start element
- *
- * Creates a new Tag object and pushes it
- * onto the stack.
- *
- * @param string $namespaceURI namespace of start tag
- * @param string $sName name of start tag
- * @param array $atts attributes of tag
- */
- protected function startElement($namespaceURI, $sName, $atts)
- {
- $this->depth++;
- $this->dataStack[$this->depth] = null;
- if (isset($atts[$this->options[XmlUnserializerOption::ATTRIBUTE_TYPE]])) {
- $type = $atts[$this->options[XmlUnserializerOption::ATTRIBUTE_TYPE]];
- $guessType = false;
- } else {
- $type = 'string';
- $guessType = $this->options[XmlUnserializerOption::GUESS_TYPES];
- }
-
- if (is_array($this->options[XmlUnserializerOption::TAG_MAP]) && isset($this->options[XmlUnserializerOption::TAG_MAP][$sName])) {
- $sName = $this->options[XmlUnserializerOption::TAG_MAP][$sName];
- }
-
- $val = array('name' => $sName,
- 'value' => null,
- 'type' => $type,
- 'guessType' => $guessType,
- 'childrenKeys' => array(),
- 'aggregKeys' => array()
- );
- if (true === $this->options[XmlUnserializerOption::ATTRIBUTES_PARSE] && (count($atts) > 0)) {
- $val['children'] = array();
- $val['type'] = 'array';
- $val['class'] = $sName;
-
- if ($this->options[XmlUnserializerOption::GUESS_TYPES]) {
- $atts = $this->guessAndSetType($atts);
- }
-
- if ($this->options[XmlUnserializerOption::ATTRIBUTES_ARRAYKEY] != false) {
- $val['children'][$this->options[XmlUnserializerOption::ATTRIBUTES_ARRAYKEY]] = $atts;
- } else {
- foreach ($atts as $attrib => $value) {
- $val['children'][$this->options[XmlUnserializerOption::ATTRIBUTES_PREPEND] . $attrib] = $value;
- }
- }
- }
-
- $keyAttr = $this->getKeyAttribute($sName);
- if (null !== $keyAttr && isset($atts[$keyAttr])) {
- $val['name'] = $atts[$keyAttr];
- }
-
- array_push($this->valueStack, $val);
- }
-
- /**
- * helper method to detect the key attribute
- *
- * @param string $sName name of element to retrieve key attribute for
- * @return string
- */
- protected function getKeyAttribute($sName)
- {
- if (is_string($this->options[XmlUnserializerOption::ATTRIBUTE_KEY])) {
- return $this->options[XmlUnserializerOption::ATTRIBUTE_KEY];
- }
-
- if (!is_array($this->options[XmlUnserializerOption::ATTRIBUTE_KEY])) {
- return null;
- }
-
-
- if (isset($this->options[XmlUnserializerOption::ATTRIBUTE_KEY][$sName])) {
- return $this->options[XmlUnserializerOption::ATTRIBUTE_KEY][$sName];
- }
-
- if (isset($this->options[XmlUnserializerOption::ATTRIBUTE_KEY]['#default'])) {
- return $this->options[XmlUnserializerOption::ATTRIBUTE_KEY]['#default'];
- }
-
- if (isset($this->options[XmlUnserializerOption::ATTRIBUTE_KEY]['__default'])) {
- return $this->options[XmlUnserializerOption::ATTRIBUTE_KEY]['__default'];
- }
-
- return null;
- }
-
- /**
- * handles the end element
- *
- * Fetches the current element from the stack and
- * converts it to the correct type.
- *
- * @param string $namespaceURI namespace of end tag
- * @param string $sName name of end tag
- * @return mixed
- */
- protected function endElement($namespaceURI, $sName)
- {
- $value = array_pop($this->valueStack);
- switch ($this->options[XmlUnserializerOption::WHITESPACE]) {
- case XmlUnserializerOption::WHITESPACE_KEEP:
- $data = $this->dataStack[$this->depth];
- break;
-
- case XmlUnserializerOption::WHITESPACE_NORMALIZE:
- $data = trim(preg_replace('/\s\s+/m', ' ', $this->dataStack[$this->depth]));
- break;
-
- case XmlUnserializerOption::WHITESPACE_TRIM:
- default:
- $data = trim($this->dataStack[$this->depth]);
- break;
- }
-
- // adjust type of the value
- switch (strtolower($value['type'])) {
- // unserialize an object
- case 'object':
- $value['value'] = new stdClass();
- if (trim($data) !== '') {
- if (true === $value['guessType']) {
- $data = $this->guessAndSetType($data);
- }
-
- $value['children'][$this->options[XmlUnserializerOption::CONTENT_KEY]] = $data;
- }
-
- // set properties
- foreach ($value['children'] as $prop => $propVal) {
- $value['value']->$prop = $propVal;
- }
- break;
-
- // unserialize an array
- case 'array':
- if (trim($data) !== '') {
- if (true === $value['guessType']) {
- $data = $this->guessAndSetType($data);
- }
-
- $value['children'][$this->options[XmlUnserializerOption::CONTENT_KEY]] = $data;
- }
-
- if (isset($value['children'])) {
- $value['value'] = $value['children'];
- } else {
- $value['value'] = array();
- }
- break;
-
- // unserialize a null value
- case 'null':
- $data = null;
- break;
-
- // unserialize a resource => this is not possible :-(
- case 'resource':
- $value['value'] = $data;
- break;
-
- // unserialize any scalar value
- default:
- if (true === $value['guessType']) {
- $data = $this->guessAndSetType($data);
- } else {
- settype($data, $value['type']);
- }
-
- $value['value'] = $data;
- break;
- }
-
- $parent = array_pop($this->valueStack);
- if (null === $parent) {
- return $value['value'];
- } else {
- // parent has to be an array
- if (!isset($parent['children']) || !is_array($parent['children'])) {
- $parent['children'] = array();
- if ('array' !== $parent['type']) {
- $parent['type'] = 'array';
- }
- }
-
- $ignoreKey = in_array($sName, $this->options[XmlUnserializerOption::IGNORE_KEYS]);
- if (!empty($value['name']) && false === $ignoreKey) {
- // there already has been a tag with this name
- if (in_array($value['name'], $parent['childrenKeys']) || in_array($value['name'], $this->options[XmlUnserializerOption::FORCE_LIST])) {
- // no aggregate has been created for this tag
- if (!in_array($value['name'], $parent['aggregKeys'])) {
- if (isset($parent['children'][$value['name']])) {
- $parent['children'][$value['name']] = array($parent['children'][$value['name']]);
- } else {
- $parent['children'][$value['name']] = array();
- }
-
- array_push($parent['aggregKeys'], $value['name']);
- }
- array_push($parent['children'][$value['name']], $value['value']);
- } else {
- $parent['children'][$value['name']] = &$value['value'];
- array_push($parent['childrenKeys'], $value['name']);
- }
- } else {
- array_push($parent['children'], $value['value']);
- }
-
- array_push($this->valueStack, $parent);
- }
-
- $this->depth--;
- }
-
- /**
- * character data handler
- *
- * Fetches the current tag from the stack and
- * appends the data.
- *
- * @param string $buf
- */
- protected function characters($buf)
- {
- $this->dataStack[$this->depth] .= $buf;
- }
-
- /**
- * try to guess the type of a value and set it accordingly
- *
- * @param string $value character data
- * @return mixed value with the best matching type
- */
- protected function guessAndSetType($value)
- {
- if (is_array($value)) {
- return array_map(array($this, 'guessAndSetType'), $value);
- }
-
- if ('true' === $value) {
- return true;
- }
-
- if ('false' === $value) {
- return false;
- }
-
- if ('NULL' === $value) {
- return null;
- }
-
- if (preg_match('/^[-+]?[0-9]{1,}$/', $value) != false) {
- return intval($value);
- }
-
- if (preg_match('/^[-+]?[0-9]{1,}\.[0-9]{1,}$/', $value) != false) {
- return doubleval($value);
- }
-
- return (string) $value;
- }
-}
-?>
147 src/main/php/net/stubbles/xml/unserializer/XmlUnserializerOption.php
View
@@ -1,147 +0,0 @@
-<?php
-/**
- * This file is part of stubbles.
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * @package net\stubbles\xml
- */
-namespace net\stubbles\xml\unserializer;
-use net\stubbles\lang\BaseObject;
-/**
- * Class to read XML files and turn them into simple PHP types.
- */
-class XmlUnserializerOption extends BaseObject
-{
- /**
- * option: name of the attribute that stores the type
- *
- * Possible values:
- * - any string
- */
- const ATTRIBUTE_KEY = 'keyAttribute';
- /**
- * option: name of the attribute that stores the type
- *
- * Possible values:
- * - any string
- */
- const ATTRIBUTE_TYPE = 'typeAttribute';
- /**
- * option: whether to parse attributes
- *
- * Possible values:
- * - true or false
- */
- const ATTRIBUTES_PARSE = 'parseAttributes';
- /**
- * option: key of the array to store attributes (if any)
- *
- * Possible values:
- * - any string
- * - false (disabled)
- */
- const ATTRIBUTES_ARRAYKEY = 'attributesArray';
- /**
- * option: string to prepend attribute name (if any)
- *
- * Possible values:
- * - any string
- * - false (disabled)
- */
- const ATTRIBUTES_PREPEND = 'prependAttributes';
- /**
- * option: key to store the content, if XML_UNSERIALIZER_ATTRIBUTES_PARSE is used
- *
- * Possible values:
- * - any string
- */
- const CONTENT_KEY = 'contentName';
- /**
- * option: map tag names
- *
- * Possible values:
- * - associative array
- */
- const TAG_MAP = 'tagMap';
- /**
- * option: list of tags that will always be enumerated
- *
- * Possible values:
- * - indexed array
- */
- const FORCE_LIST = 'forceList';
- /**
- * option: encoding of the XML document
- *
- * Possible values:
- * - UTF-8
- * - ISO-8859-1
- */
- const ENCODING_SOURCE = 'encoding';
- /**
- * option: list of tags, that will not be used as keys
- *
- * Possible values:
- * - true or false
- */
- const IGNORE_KEYS = 'ignoreKeys';
- /**
- * option: whether to use type guessing for scalar values
- *
- * Possible values:
- * - true or false
- */
- const GUESS_TYPES = 'guessTypes';
- /**
- * option: set the whitespace behaviour
- *
- * Possible values:
- * - WHITESPACE_KEEP
- * - WHITESPACE_TRIM
- * - WHITESPACE_NORMALIZE
- */
- const WHITESPACE = 'whitespace';
- /**
- * Keep all whitespace
- */
- const WHITESPACE_KEEP = 'keep';
- /**
- * remove whitespace from start and end of the data
- */
- const WHITESPACE_TRIM = 'trim';
- /**
- * normalize whitespace
- */
- const WHITESPACE_NORMALIZE = 'normalize';
- /**
- * default options for the serialization
- *
- * @type array
- */
- protected static $defaultOptions = array(self::ATTRIBUTE_KEY => '_originalKey', // get array key/property name from this attribute
- self::ATTRIBUTE_TYPE => '_type', // get type from this attribute
- self::ATTRIBUTES_PARSE => false, // parse the attributes of the tag into an array
- self::ATTRIBUTES_ARRAYKEY => false, // parse them into sperate array (specify name of array here)
- self::ATTRIBUTES_PREPEND => '', // prepend attribute names with this string
- self::CONTENT_KEY => '_content', // put cdata found in a tag that has been converted to a complex type in this key
- self::TAG_MAP => array(), // use this to map tagnames
- self::FORCE_LIST => array(), // these tags will always be an indexed array
- self::ENCODING_SOURCE => null, // specify the encoding character of the document to parse
- self::WHITESPACE => self::WHITESPACE_TRIM, // remove whitespace around data
- self::IGNORE_KEYS => array(), // list of tags that will automatically be added to the parent, instead of adding a new key
- self::GUESS_TYPES => false // Whether to use type guessing
- );
-
- /**
- * returns list of default options
- *
- * @return array
- */
- public static function getDefault()
- {
- return self::$defaultOptions;
- }
-}
-?>
309 src/test/php/net/stubbles/xml/unserializer/XmlUnserializerTestCase.php
View
@@ -1,309 +0,0 @@
-<?php
-/**
- * This file is part of stubbles.
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * @package net\stubbles\xml
- */
-namespace net\stubbles\xml\unserializer;
-use org\bovigo\vfs\vfsStream;
-/**
- * Test for net\stubbles\xml\unserializer\XmlUnserializer.
- *
- * @group xml
- * @group xml_unserializer
- */
-class XmlUnserializerTestCase extends \PHPUnit_Framework_TestCase
-{
- /**
- * test unserializing any XML
- *
- * @test
- */
- public function unserializeAnyXML()
- {
- $xml = '<?xml version="1.0" encoding="iso-8859-1"?>' .
- '<users>' .
- ' <user handle="schst">Stephan Schmidt</user>' .
- ' <user handle="mikey">Frank Kleine</user>' .
- ' <group name="dev">Stubbles Development Team</group>' .
- ' <foo id="test">This is handled by the default keyAttribute</foo>' .
- ' <foo id="test2">Another foo tag</foo>' .
- '</users>';
- $options = array(XmlUnserializerOption::ATTRIBUTE_KEY => array('user' => 'handle',
- 'group' => 'name',
- '#default' => 'id'
- )
- );
- $unserializer = new XmlUnserializer($options);
- $this->assertEquals(array('schst' => 'Stephan Schmidt',
- 'mikey' => 'Frank Kleine',
- 'dev' => 'Stubbles Development Team',
- 'test' => 'This is handled by the default keyAttribute',
- 'test2' => 'Another foo tag'
- ),
- $unserializer->unserialize($xml)
- );
- }
-
- /**
- * test unserializing a list of items
- *
- * @test
- */
- public function unserializeList()
- {
- $xml1 = '<?xml version="1.0" encoding="iso-8859-1"?>
- <root>
- <item>
- <name>schst</name>
- </item>
- <item>
- <name>mikey</name>
- </item>
- </root>';
-
- $xml2 = '<?xml version="1.0" encoding="iso-8859-1"?>
- <root>
- <item>
- <name>schst</name>
- </item>
- </root>';
- $options = array(XmlUnserializerOption::FORCE_LIST => array('item'));
- $unserializer = new XmlUnserializer($options);
- $this->assertEquals(array('item' => array(array('name' => 'schst'),
- array('name' => 'mikey')
- )
- ),
- $unserializer->unserialize($xml1)
- );
- $this->assertEquals(array('item' => array(array('name' => 'schst'))), $unserializer->unserialize($xml2));
- }
-
- /**
- * test that whitespace handling works as expected
- *
- * @test
- */
- public function whiteSpaceTrim()
- {
- $xml = '<?xml version="1.0" encoding="iso-8859-1"?>
- <xml>
- <string>
-
- This XML
- document
- contains
- line breaks.
-
- </string>
- </xml>';
- $options = array(XmlUnserializerOption::WHITESPACE => XmlUnserializerOption::WHITESPACE_TRIM);
- $unserializer = new XmlUnserializer($options);
- $this->assertEquals(array('string' => 'This XML
- document
- contains
- line breaks.'),
- $unserializer->unserialize($xml)
- );
- }
-
- /**
- * test that whitespace handling works as expected
- *
- * @test
- */
- public function whiteSpaceNormalize()
- {
- $xml = '<?xml version="1.0" encoding="iso-8859-1"?>
- <xml>
- <string>
-
- This XML
- document
- contains
- line breaks.
-
- </string>
- </xml>';
- $options = array(XmlUnserializerOption::WHITESPACE => XmlUnserializerOption::WHITESPACE_NORMALIZE);
- $unserializer = new XmlUnserializer($options);
- $this->assertEquals(array('string' => 'This XML document contains line breaks.'), $unserializer->unserialize($xml));
- }
-
- /**
- * test that whitespace handling works as expected
- *
- * @test
- */
- public function whiteSpaceKeep()
- {
- $xml = '<?xml version="1.0" encoding="iso-8859-1"?>
- <xml>
- <string>
-
- This XML
- document
- contains
- line breaks.
-
- </string>
- </xml>';
- $options = array(XmlUnserializerOption::WHITESPACE => XmlUnserializerOption::WHITESPACE_KEEP);
- $unserializer = new XmlUnserializer($options);
- $this->assertEquals(array('string' => '
-
- This XML
- document
- contains
- line breaks.
-
- '),
- $unserializer->unserialize($xml)
- );
- }
-
- /**
- * test unserializing a list of items
- *
- * @test
- */
- public function unserializeWithAttributes()
- {
- $root = vfsStream::setup();
- vfsStream::newFile('unserializer.xml')
- ->withContent('<xml>
- <test foo="bar">
- Test
- <tag>test</tag>
- </test>
-</xml>')
- ->at($root);
- $options = array(XmlUnserializerOption::ATTRIBUTES_PARSE => true,
- XmlUnserializerOption::ATTRIBUTES_ARRAYKEY => false
- );
- $unserializer = new XmlUnserializer($options);
- $this->assertEquals(array('test' => array('foo' => 'bar',
- 'tag' => 'test',
- '_content' => 'Test'
- )
- ),
- $unserializer->unserializeFile(vfsStream::url('root/unserializer.xml'))
- );
- }
-
- /**
- * test unserializing a list of items
- *
- * @test
- */
- public function unserializeWithTagMap()
- {
- $xml1 = '<?xml version="1.0" encoding="iso-8859-1"?>' .
- '<root>' .
- ' <foo>FOO</foo>' .
- ' <bar>BAR</bar>' .
- '</root>';
- $xml2 = '<?xml version="1.0" encoding="iso-8859-1"?>' .
- '<root>' .
- ' <foo>'.
- ' <tomato>45</tomato>'.
- ' </foo>'.
- ' <bar>'.
- ' <tomato>31</tomato>'.
- ' </bar>'.
- '</root>';
- $options = array(XmlUnserializerOption::TAG_MAP => array('foo' => 'bar',
- 'bar' => 'foo'
- )
- );
- $unserializer = new XmlUnserializer($options);
- $this->assertEquals(array('bar' => 'FOO',
- 'foo' => 'BAR'
- ),
- $unserializer->unserialize($xml1)
- );
- $this->assertEquals(array('bar' => array('tomato' => 45),
- 'foo' => array('tomato' => 31)
- ),
- $unserializer->unserialize($xml2)
- );
- }
-
- /**
- * test unserializing a list of items
- *
- * @test
- */
- public function unserializeWithTypeGuessing()
- {
- $xml = '<?xml version="1.0" encoding="iso-8859-1"?>' .
- '<root>' .
- ' <string>Just a string...</string>' .
- ' <booleanValue>true</booleanValue>' .
- ' <foo>-563</foo>' .
- ' <bar>4.73736</bar>' .
- ' <array foo="false" bar="12">true</array>' .
- '</root>';
- $options = array(XmlUnserializerOption::ATTRIBUTES_PARSE => true,
- XmlUnserializerOption::GUESS_TYPES => true
- );
- $unserializer = new XmlUnserializer($options);
- $result = $unserializer->unserialize($xml);
- $this->assertEquals(array('string' => 'Just a string...',
- 'booleanValue' => true,
- 'foo' => -563,
- 'bar' => 4.73736,
- 'array' => array('foo' => false,
- 'bar' => 12,
- '_content' => true
- )
- ),
- $result
- );
- $this->assertTrue($result['booleanValue']);
- $this->assertTrue(is_int($result['foo']));
- $this->assertTrue(is_float($result['bar']));
- $this->assertFalse($result['array']['foo']);
- $this->assertTrue(is_int($result['array']['bar']));
- $this->assertTrue($result['array']['_content']);
- }
-
- /**
- * assert that output encoding is UTF-8
- *
- * @test
- */
- public function returnEncoding()
- {
- $xml = '<?xml version="1.0" encoding="iso-8859-1"?><root><string>A string containing german umlauts: ' . utf8_decode('äöü') . '</string></root>';
- $unserializer = new XmlUnserializer();
- $this->assertEquals(array('string' => utf8_encode('A string containing german umlauts: ' . utf8_decode('äöü'))), $unserializer->unserialize($xml));
- }
-
- /**
- * assert that cdata is supported
- *
- * @test
- */
- public function cDATA()
- {
- $xml = '<?xml version="1.0" encoding="iso-8859-1"?><root><string><![CDATA[A string containing german umlauts: &' . utf8_decode('äöü') . ']]></string></root>';
- $unserializer = new XmlUnserializer();
- $this->assertEquals(array('string' => utf8_encode('A string containing german umlauts: &' . utf8_decode('äöü'))), $unserializer->unserialize($xml));
- }
-
- /**
- * @test
- * @expectedException net\stubbles\lang\exception\FileNotFoundException
- */
- public function unserializeNonExistingFileThrowsFileNotFoundException()
- {
- vfsStream::setup();
- $unserializer = new XmlUnserializer();
- $unserializer->unserializeFile(vfsStream::url('root/doesNotExist.xml'));
- }
-}
-?>
Please sign in to comment.
Something went wrong with that request. Please try again.