From 24c143c990aa0d8b28acfab233d02da94311eac2 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Thu, 12 Jul 2012 21:11:36 +0200 Subject: [PATCH] [PSR-2] fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed Applied php-cs-fixer --fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed --- src/Factory.php | 12 ++++----- src/Processor/Filter.php | 2 +- src/Reader/Ini.php | 4 +-- src/Reader/Json.php | 18 ++++++------- src/Reader/Xml.php | 8 +++--- src/Reader/Yaml.php | 24 ++++++++--------- src/ReaderPluginManager.php | 4 +-- src/Writer/AbstractWriter.php | 4 +-- src/Writer/Xml.php | 2 +- src/Writer/Yaml.php | 8 +++--- test/ConfigTest.php | 12 ++++----- test/FactoryTest.php | 16 ++++++------ test/ProcessorTest.php | 36 +++++++++++++------------- test/Reader/AbstractReaderTestCase.php | 12 ++++----- test/Reader/IniTest.php | 16 ++++++------ test/Reader/JsonTest.php | 20 +++++++------- test/Reader/XmlTest.php | 12 ++++----- test/Reader/YamlTest.php | 18 ++++++------- test/Writer/AbstractWriterTestCase.php | 14 +++++----- test/Writer/PhpArrayTest.php | 4 +-- test/Writer/XmlTest.php | 8 +++--- test/Writer/YamlTest.php | 6 ++--- 22 files changed, 129 insertions(+), 131 deletions(-) diff --git a/src/Factory.php b/src/Factory.php index e18b2d1..4631562 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -43,7 +43,7 @@ class Factory * Read a config from a file. * * @param string $filename - * @param boolean $returnConfigObject + * @param boolean $returnConfigObject * @return array|Config * @throws Exception\InvalidArgumentException * @throws Exception\RuntimeException @@ -51,16 +51,16 @@ class Factory public static function fromFile($filename, $returnConfigObject = false) { $pathinfo = pathinfo($filename); - + if (!isset($pathinfo['extension'])) { throw new Exception\RuntimeException(sprintf( 'Filename "%s" is missing an extension and cannot be auto-detected', $filename )); } - + $extension = strtolower($pathinfo['extension']); - + if ($extension === 'php') { if (!is_file($filename) || !is_readable($filename)) { throw new Exception\RuntimeException(sprintf( @@ -68,7 +68,7 @@ public static function fromFile($filename, $returnConfigObject = false) $filename )); } - + $config = include $filename; } elseif (isset(self::$extensions[$extension])) { $reader = self::$extensions[$extension]; @@ -93,7 +93,7 @@ public static function fromFile($filename, $returnConfigObject = false) * Read configuration from multiple files and merge them. * * @param array $files - * @param boolean $returnConfigObject + * @param boolean $returnConfigObject * @return array|Config */ public static function fromFiles(array $files, $returnConfigObject = false) diff --git a/src/Processor/Filter.php b/src/Processor/Filter.php index e8154da..1ed0f31 100644 --- a/src/Processor/Filter.php +++ b/src/Processor/Filter.php @@ -56,7 +56,7 @@ public function getFilter() /** * Process - * + * * @param Config $config * @return Config * @throws Exception\InvalidArgumentException diff --git a/src/Reader/Ini.php b/src/Reader/Ini.php index b02df3b..6498c0f 100644 --- a/src/Reader/Ini.php +++ b/src/Reader/Ini.php @@ -86,7 +86,7 @@ function($error, $message = '', $file = '', $line = 0) use ($filename) { ); $ini = parse_ini_file($filename, true); restore_error_handler(); - + return $this->process($ini); } @@ -114,7 +114,7 @@ function($error, $message = '', $file = '', $line = 0) { ); $ini = parse_ini_string($string, true); restore_error_handler(); - + return $this->process($ini); } diff --git a/src/Reader/Json.php b/src/Reader/Json.php index a84b7e4..5d6b7bd 100644 --- a/src/Reader/Json.php +++ b/src/Reader/Json.php @@ -46,15 +46,15 @@ public function fromFile($filename) $filename )); } - + $this->directory = dirname($filename); - + try { $config = JsonFormat::decode(file_get_contents($filename), JsonFormat::TYPE_ARRAY); } catch (JsonException\RuntimeException $e) { throw new Exception\RuntimeException($e->getMessage()); - } - + } + return $this->process($config); } @@ -73,19 +73,19 @@ public function fromString($string) } $this->directory = null; - + try { $config = JsonFormat::decode($string, JsonFormat::TYPE_ARRAY); } catch (JsonException\RuntimeException $e) { throw new Exception\RuntimeException($e->getMessage()); - } - + } + return $this->process($config); } /** * Process the array for @include - * + * * @param array $data * @return array * @throws Exception\RuntimeException @@ -103,7 +103,7 @@ protected function process(array $data) $reader = clone $this; unset($data[$key]); $data = array_replace_recursive($data, $reader->fromFile($this->directory . '/' . $value)); - } + } } return $data; } diff --git a/src/Reader/Xml.php b/src/Reader/Xml.php index ed6ebe8..98a1d0f 100644 --- a/src/Reader/Xml.php +++ b/src/Reader/Xml.php @@ -80,7 +80,7 @@ function($error, $message = '', $file = '', $line = 0) use ($filename) { ); $return = $this->process(); restore_error_handler(); - + return $return; } @@ -98,7 +98,7 @@ public function fromString($string) return array(); } $this->reader = new XMLReader(); - + $this->reader->xml($string, null, LIBXML_XINCLUDE); $this->directory = null; @@ -113,7 +113,7 @@ function($error, $message = '', $file = '', $line = 0) { ); $return = $this->process(); restore_error_handler(); - + return $return; } @@ -175,7 +175,7 @@ protected function processNextElement() $text .= $this->reader->value; } } - + return $children ?: $text; } diff --git a/src/Reader/Yaml.php b/src/Reader/Yaml.php index 5c638cc..c33ef29 100644 --- a/src/Reader/Yaml.php +++ b/src/Reader/Yaml.php @@ -23,21 +23,21 @@ class Yaml implements ReaderInterface { /** * Directory of the YAML file - * + * * @var string */ protected $directory; /** * YAML decoder callback - * + * * @var callable */ protected $yamlDecoder; /** * Constructor - * + * * @param callable $yamlDecoder */ public function __construct($yamlDecoder = null) @@ -99,14 +99,14 @@ public function fromFile($filename) if (null === $this->getYamlDecoder()) { throw new Exception\RuntimeException("You didn't specify a Yaml callback decoder"); } - + $this->directory = dirname($filename); - + $config = call_user_func($this->getYamlDecoder(), file_get_contents($filename)); if (null === $config) { throw new Exception\RuntimeException("Error parsing YAML data"); - } - + } + return $this->process($config); } @@ -126,14 +126,14 @@ public function fromString($string) if (empty($string)) { return array(); } - + $this->directory = null; - + $config = call_user_func($this->getYamlDecoder(), $string); if (null === $config) { throw new Exception\RuntimeException("Error parsing YAML data"); - } - + } + return $this->process($config); } @@ -157,7 +157,7 @@ protected function process(array $data) $reader = clone $this; unset($data[$key]); $data = array_replace_recursive($data, $reader->fromFile($this->directory . '/' . $value)); - } + } } return $data; } diff --git a/src/ReaderPluginManager.php b/src/ReaderPluginManager.php index c059725..2614fd0 100644 --- a/src/ReaderPluginManager.php +++ b/src/ReaderPluginManager.php @@ -20,7 +20,7 @@ class ReaderPluginManager extends AbstractPluginManager { /** * Default set of readers - * + * * @var array */ protected $invokableClasses = array( @@ -33,7 +33,7 @@ class ReaderPluginManager extends AbstractPluginManager /** * Validate the plugin * Checks that the reader loaded is an instance of Reader\ReaderInterface. - * + * * @param Reader\ReaderInterface $plugin * @return void * @throws Exception\InvalidArgumentException if invalid diff --git a/src/Writer/AbstractWriter.php b/src/Writer/AbstractWriter.php index b2817ec..4726075 100644 --- a/src/Writer/AbstractWriter.php +++ b/src/Writer/AbstractWriter.php @@ -38,12 +38,12 @@ public function toFile($filename, $config, $exclusiveLock = true) if (empty($filename)) { throw new Exception\InvalidArgumentException('No file name specified'); } - + $flags = 0; if ($exclusiveLock) { $flags |= LOCK_EX; } - + set_error_handler( function($error, $message = '', $file = '', $line = 0) use ($filename) { throw new Exception\RuntimeException(sprintf( diff --git a/src/Writer/Xml.php b/src/Writer/Xml.php index c4e0827..844a38f 100644 --- a/src/Writer/Xml.php +++ b/src/Writer/Xml.php @@ -71,7 +71,7 @@ protected function addBranch($branchName, array $config, XMLWriter $writer) $writer->startElement($branchName); $branchType = 'string'; } - } else if ($branchType !== (is_numeric($key) ? 'numeric' : 'string')) { + } elseif ($branchType !== (is_numeric($key) ? 'numeric' : 'string')) { throw new Exception\RuntimeException('Mixing of string and numeric keys is not allowed'); } diff --git a/src/Writer/Yaml.php b/src/Writer/Yaml.php index fc4e8e8..9d4c309 100644 --- a/src/Writer/Yaml.php +++ b/src/Writer/Yaml.php @@ -21,14 +21,14 @@ class Yaml extends AbstractWriter { /** * YAML encoder callback - * + * * @var callable */ protected $yamlEncoder; /** * Constructor - * + * * @param callable|string|null $yamlEncoder */ public function __construct($yamlEncoder = null) @@ -80,12 +80,12 @@ public function processConfig(array $config) if (null === $this->getYamlEncoder()) { throw new Exception\RuntimeException("You didn't specify a Yaml callback encoder"); } - + $config = call_user_func($this->getYamlEncoder(), $config); if (null === $config) { throw new Exception\RuntimeException("Error generating YAML data"); } - + return $config; } } diff --git a/test/ConfigTest.php b/test/ConfigTest.php index fb91052..25eac99 100644 --- a/test/ConfigTest.php +++ b/test/ConfigTest.php @@ -483,8 +483,7 @@ public function testUnsettingFirstElementDuringForeachDoesNotSkipAnElement() ), true); $keyList = array(); - foreach ($config as $key => $value) - { + foreach ($config as $key => $value) { $keyList[] = $key; if ($key == 'first') { unset($config->$key); // uses magic Zend\Config\Config::__unset() method @@ -509,8 +508,7 @@ public function testUnsettingAMiddleElementDuringForeachDoesNotSkipAnElement() ), true); $keyList = array(); - foreach ($config as $key => $value) - { + foreach ($config as $key => $value) { $keyList[] = $key; if ($key == 'second') { unset($config->$key); // uses magic Zend\Config\Config::__unset() method @@ -535,8 +533,7 @@ public function testUnsettingLastElementDuringForeachDoesNotSkipAnElement() ), true); $keyList = array(); - foreach ($config as $key => $value) - { + foreach ($config as $key => $value) { $keyList[] = $key; if ($key == 'third') { unset($config->$key); // uses magic Zend\Config\Config::__unset() method @@ -576,7 +573,8 @@ public function testZF6995_toArrayDoesNotDisturbInternalIterator() * @depends testMerge * @link http://framework.zend.com/issues/browse/ZF2-186 */ - public function testZF2_186_mergeReplacingUnnamedConfigSettings(){ + public function testZF2_186_mergeReplacingUnnamedConfigSettings() + { $arrayA = array( 'flag' => true, 'text' => 'foo', diff --git a/test/FactoryTest.php b/test/FactoryTest.php index 466c90f..ffd4836 100644 --- a/test/FactoryTest.php +++ b/test/FactoryTest.php @@ -23,17 +23,17 @@ class FactoryTest extends \PHPUnit_Framework_TestCase public function testFromIni() { $config = Factory::fromFile(__DIR__ . '/TestAssets/Ini/include-base.ini'); - + $this->assertEquals('bar', $config['base']['foo']); } - + public function testFromXml() { $config = Factory::fromFile(__DIR__ . '/TestAssets/Xml/include-base.xml'); - + $this->assertEquals('bar', $config['base']['foo']); } - + public function testFromIniFiles() { $files = array ( @@ -45,7 +45,7 @@ public function testFromIniFiles() $this->assertEquals('bar', $config['base']['foo']); $this->assertEquals('baz', $config['test']['bar']); } - + public function testFromXmlFiles() { $files = array ( @@ -57,7 +57,7 @@ public function testFromXmlFiles() $this->assertEquals('bar', $config['base']['foo']); $this->assertEquals('baz', $config['test']['bar']); } - + public function testFromPhpFiles() { $files = array ( @@ -69,7 +69,7 @@ public function testFromPhpFiles() $this->assertEquals('bar', $config['base']['foo']); $this->assertEquals('baz', $config['test']['bar']); } - + public function testFromIniAndXmlAndPhpFiles() { $files = array ( @@ -89,7 +89,7 @@ public function testReturnsConfigObjectIfRequestedAndArrayOtherwise() $files = array ( __DIR__ . '/TestAssets/Ini/include-base.ini', ); - + $configArray = Factory::fromFile($files[0]); $this->assertTrue(is_array($configArray)); diff --git a/test/ProcessorTest.php b/test/ProcessorTest.php index 9adc3fe..aaeb368 100644 --- a/test/ProcessorTest.php +++ b/test/ProcessorTest.php @@ -181,7 +181,7 @@ public function testAddInvalidToken() 'Cannot use ' . gettype(array()) . ' as token name.'); $processor->addToken(array(), 'bar'); } - + public function testSingleValueToken() { $processor = new TokenProcessor(); @@ -190,18 +190,18 @@ public function testSingleValueToken() $out = $processor->processValue($data); $this->assertEquals($out, 'test'); } - + public function testTokenReadOnly() { $config = new Config($this->tokenBare, false); $processor = new TokenProcessor(); $processor->addToken('BARETOKEN', 'some replaced value'); - + $this->setExpectedException('Zend\Config\Exception\InvalidArgumentException', 'Cannot process config because it is read-only'); $processor->process($config); } - + public function testTokenPrefix() { $config = new Config($this->tokenPrefix, true); @@ -287,7 +287,7 @@ public function testUserConstants() $this->assertTrue(is_array($tokens)); $this->assertTrue(in_array('SOME_USERLAND_CONSTANT', $tokens)); $this->assertTrue(!$processor->getUserOnly()); - + $this->assertEquals('some constant value', $config->simple); $this->assertEquals('some text with some constant value inside', $config->inside); $this->assertEquals('some constant value', $config->nested->simple); @@ -305,17 +305,17 @@ public function testUserOnlyConstants() $processor->process($config); $tokens = $processor->getTokens(); - + $this->assertTrue(is_array($tokens)); $this->assertTrue(in_array('SOME_USERLAND_CONSTANT', $tokens)); $this->assertTrue($processor->getUserOnly()); - + $this->assertEquals('some constant value', $config->simple); $this->assertEquals('some text with some constant value inside', $config->inside); $this->assertEquals('some constant value', $config->nested->simple); $this->assertEquals('some text with some constant value inside', $config->nested->inside); } - + /** * @depends testTokenSurround */ @@ -358,7 +358,7 @@ public function testTranslatorReadOnly() } public function testTranslatorSingleValue() - { + { $translator = new Translator(); $translator->addTranslationFile('phparray', $this->translatorFile); $processor = new TranslatorProcessor($translator); @@ -371,7 +371,7 @@ public function testFilter() $config = new Config($this->filter, true); $filter = new StringToLower(); $processor = new FilterProcessor($filter); - + $this->assertTrue($processor->getFilter() instanceof StringToLower); $processor->process($config); @@ -384,21 +384,21 @@ public function testFilterReadOnly() $config = new Config($this->filter, false); $filter = new StringToLower(); $processor = new FilterProcessor($filter); - + $this->setExpectedException('Zend\Config\Exception\InvalidArgumentException', 'Cannot process config because it is read-only'); $processor->process($config); } - + public function testFilterValue() { $filter = new StringToLower(); $processor = new FilterProcessor($filter); - + $value = 'TEST'; $this->assertEquals('test', $processor->processValue($value)); } - + /** * @depends testFilter */ @@ -421,7 +421,7 @@ public function testQueueFIFO() $this->assertEquals('some mixedcase value', $config->simple); $this->assertEquals('other mixed case value', $config->nested->simple); } - + public function testQueueReadOnly() { $config = new Config($this->filter, false); @@ -433,7 +433,7 @@ public function testQueueReadOnly() */ $queue = new Queue(); $queue->insert($lowerProcessor); - + $this->setExpectedException('Zend\Config\Exception\InvalidArgumentException', 'Cannot process config because it is read-only'); $queue->process($config); @@ -452,10 +452,10 @@ public function testQueueSingleValue() $queue = new Queue(); $queue->insert($upperProcessor); $queue->insert($lowerProcessor); - + $data ='TeSt'; $this->assertEquals('test', $queue->processValue($data)); - + } /** diff --git a/test/Reader/AbstractReaderTestCase.php b/test/Reader/AbstractReaderTestCase.php index 05db52c..1e45a5c 100644 --- a/test/Reader/AbstractReaderTestCase.php +++ b/test/Reader/AbstractReaderTestCase.php @@ -26,28 +26,28 @@ abstract class AbstractReaderTestCase extends TestCase * @var ReaderInterface */ protected $reader; - + /** * Get test asset name for current test case. - * + * * @param string $name * @return string */ abstract protected function getTestAssetPath($name); - + public function testMissingFile() { $filename = $this->getTestAssetPath('no-file'); $this->setExpectedException('Zend\Config\Exception\RuntimeException', "doesn't exist or not readable"); - $config = $this->reader->fromFile($filename); + $config = $this->reader->fromFile($filename); } - + public function testFromFile() { $config = $this->reader->fromFile($this->getTestAssetPath('include-base')); $this->assertEquals('foo', $config['foo']); } - + public function testFromEmptyString() { $config = $this->reader->fromString(''); diff --git a/test/Reader/IniTest.php b/test/Reader/IniTest.php index e17452a..f814218 100644 --- a/test/Reader/IniTest.php +++ b/test/Reader/IniTest.php @@ -24,10 +24,10 @@ public function setUp() { $this->reader = new Ini(); } - + /** * getTestAssetPath(): defined by AbstractReaderTestCase. - * + * * @see AbstractReaderTestCase::getTestAssetPath() * @return string */ @@ -35,14 +35,14 @@ protected function getTestAssetPath($name) { return __DIR__ . '/TestAssets/Ini/' . $name . '.ini'; } - + public function testInvalidIniFile() { $this->reader = new Ini(); $this->setExpectedException('Zend\Config\Exception\RuntimeException'); $arrayIni = $this->reader->fromFile($this->getTestAssetPath('invalid')); } - + public function testFromString() { $ini = <<reader->fromString($ini); $this->assertEquals($arrayIni['test'], 'foo'); $this->assertEquals($arrayIni['bar'][0], 'baz'); $this->assertEquals($arrayIni['bar'][1], 'foo'); } - + public function testInvalidString() { $ini = <<setExpectedException('Zend\Config\Exception\RuntimeException'); $arrayIni = $this->reader->fromString($ini); } - + public function testFromStringWithSection() { $ini = <<reader->fromString($ini); $this->assertEquals($arrayIni['all']['test'], 'foo'); $this->assertEquals($arrayIni['all']['bar'][0], 'baz'); diff --git a/test/Reader/JsonTest.php b/test/Reader/JsonTest.php index 0832624..20cc681 100644 --- a/test/Reader/JsonTest.php +++ b/test/Reader/JsonTest.php @@ -24,10 +24,10 @@ public function setUp() { $this->reader = new Json(); } - + /** * getTestAssetPath(): defined by AbstractReaderTestCase. - * + * * @see AbstractReaderTestCase::getTestAssetPath() * @return string */ @@ -35,36 +35,36 @@ protected function getTestAssetPath($name) { return __DIR__ . '/TestAssets/Json/' . $name . '.json'; } - + public function testInvalidJsonFile() { $this->setExpectedException('Zend\Config\Exception\RuntimeException'); $arrayJson = $this->reader->fromFile($this->getTestAssetPath('invalid')); } - + public function testIncludeAsElement() { $arrayJson = $this->reader->fromFile($this->getTestAssetPath('include-base_nested')); $this->assertEquals($arrayJson['bar']['foo'], 'foo'); } - + public function testFromString() { $json = '{ "test" : "foo", "bar" : [ "baz", "foo" ] }'; - + $arrayJson = $this->reader->fromString($json); - + $this->assertEquals($arrayJson['test'], 'foo'); $this->assertEquals($arrayJson['bar'][0], 'baz'); $this->assertEquals($arrayJson['bar'][1], 'foo'); } - + public function testInvalidString() { $json = '{"foo":"bar"'; - + $this->setExpectedException('Zend\Config\Exception\RuntimeException'); $arrayIni = $this->reader->fromString($json); } - + } diff --git a/test/Reader/XmlTest.php b/test/Reader/XmlTest.php index 066a1eb..9258a74 100644 --- a/test/Reader/XmlTest.php +++ b/test/Reader/XmlTest.php @@ -24,10 +24,10 @@ public function setUp() { $this->reader = new Xml(); } - + /** * getTestAssetPath(): defined by AbstractReaderTestCase. - * + * * @see AbstractReaderTestCase::getTestAssetPath() * @return string */ @@ -35,14 +35,14 @@ protected function getTestAssetPath($name) { return __DIR__ . '/TestAssets/Xml/' . $name . '.xml'; } - + public function testInvalidXmlFile() { $this->reader = new Xml(); $this->setExpectedException('Zend\Config\Exception\RuntimeException'); $arrayXml = $this->reader->fromFile($this->getTestAssetPath('invalid')); } - + public function testFromString() { $xml = << ECS; - + $arrayXml= $this->reader->fromString($xml); $this->assertEquals($arrayXml['test'], 'foo'); $this->assertEquals($arrayXml['bar'][0], 'baz'); $this->assertEquals($arrayXml['bar'][1], 'foo'); } - + public function testInvalidString() { $xml = <<markTestSkipped('Yaml test for Zend\Config skipped'); } - + if (constant('TESTS_ZEND_CONFIG_YAML_LIB_INCLUDE')) { require_once constant('TESTS_ZEND_CONFIG_YAML_LIB_INCLUDE'); } - + $yamlReader = explode('::', constant('TESTS_ZEND_CONFIG_READER_YAML_CALLBACK')); if (isset($yamlReader[1])) { $this->reader = new YamlReader(array($yamlReader[0], $yamlReader[1])); @@ -38,10 +38,10 @@ public function setUp() $this->reader = new YamlReader(array($yamlReader[0])); } } - + /** * getTestAssetPath(): defined by AbstractReaderTestCase. - * + * * @see AbstractReaderTestCase::getTestAssetPath() * @return string */ @@ -49,13 +49,13 @@ protected function getTestAssetPath($name) { return __DIR__ . '/TestAssets/Yaml/' . $name . '.yaml'; } - + public function testInvalidIniFile() { $this->setExpectedException('Zend\Config\Exception\RuntimeException'); $arrayIni = $this->reader->fromFile($this->getTestAssetPath('invalid')); } - + public function testFromString() { $yaml = <<reader->fromString($yaml); $this->assertEquals($arrayYaml['test'], 'foo'); $this->assertEquals($arrayYaml['bar'][0], 'baz'); $this->assertEquals($arrayYaml['bar'][1], 'foo'); } - + public function testFromStringWithSection() { $yaml = <<tmpfile; } - + public function tearDown() { if (file_exists($this->getTestAssetFileName())) { @@ -60,7 +60,7 @@ public function tearDown() @unlink($this->getTestAssetFileName()); } } - + public function testNoFilenameSet() { $this->setExpectedException('Zend\Config\Exception\InvalidArgumentException', 'No file name specified'); @@ -72,7 +72,7 @@ public function testFileNotValid() $this->setExpectedException('Zend\Config\Exception\RuntimeException'); $this->writer->toFile('.', new Config(array())); } - + public function testFileNotWritable() { $this->setExpectedException('Zend\Config\Exception\RuntimeException'); diff --git a/test/Writer/PhpArrayTest.php b/test/Writer/PhpArrayTest.php index 80d2e80..2dae349 100644 --- a/test/Writer/PhpArrayTest.php +++ b/test/Writer/PhpArrayTest.php @@ -36,7 +36,7 @@ public function setUp() public function testRender() { $config = new Config(array('test' => 'foo', 'bar' => array(0 => 'baz', 1 => 'foo'))); - + $configString = $this->writer->toString($config); // build string line by line as we are trailing-whitespace sensitive. @@ -49,7 +49,7 @@ public function testRender() $expected .= " 1 => 'foo',\n"; $expected .= " ),\n"; $expected .= ");\n"; - + $this->assertEquals($expected, $configString); } } diff --git a/test/Writer/XmlTest.php b/test/Writer/XmlTest.php index f2a8a7d..16f0c70 100644 --- a/test/Writer/XmlTest.php +++ b/test/Writer/XmlTest.php @@ -48,7 +48,7 @@ public function testToString() $this->assertEquals($expected, $configString); } - + public function testSectionsToString() { $config = new Config(array(), true); @@ -61,9 +61,9 @@ public function testSectionsToString() $config->production->database->params->username = 'production'; $config->production->database->params->password = 'secret'; $config->production->database->params->dbname = 'dbproduction'; - + $configString = $this->writer->toString($config); - + $expected = << @@ -81,7 +81,7 @@ public function testSectionsToString() ECS; - + $this->assertEquals($expected, $configString); } } diff --git a/test/Writer/YamlTest.php b/test/Writer/YamlTest.php index cc2c864..d0d9db1 100644 --- a/test/Writer/YamlTest.php +++ b/test/Writer/YamlTest.php @@ -27,18 +27,18 @@ public function setUp() if (!constant('TESTS_ZEND_CONFIG_YAML_ENABLED')) { $this->markTestSkipped('Yaml test for Zend\Config skipped'); } - + if (constant('TESTS_ZEND_CONFIG_YAML_LIB_INCLUDE')) { require_once constant('TESTS_ZEND_CONFIG_YAML_LIB_INCLUDE'); } - + $yamlReader = explode('::', constant('TESTS_ZEND_CONFIG_READER_YAML_CALLBACK')); if (isset($yamlReader[1])) { $this->reader = new YamlReader(array($yamlReader[0], $yamlReader[1])); } else { $this->reader = new YamlReader(array($yamlReader[0])); } - + $yamlWriter = explode('::', constant('TESTS_ZEND_CONFIG_WRITER_YAML_CALLBACK')); if (isset($yamlWriter[1])) { $this->writer = new YamlWriter(array($yamlWriter[0], $yamlWriter[1]));