From 84c7b61c3eecdbd12b31a8c5bb7d25e1c5586e84 Mon Sep 17 00:00:00 2001 From: Shane Auckland Date: Fri, 26 Jun 2015 14:14:49 +0100 Subject: [PATCH 1/2] Remove unnecessary method argument --- .../CodeGenerator/Generator/Xml/ConfigGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MageTest/PhpSpec/MagentoExtension/CodeGenerator/Generator/Xml/ConfigGenerator.php b/src/MageTest/PhpSpec/MagentoExtension/CodeGenerator/Generator/Xml/ConfigGenerator.php index b6e0989..b9f431a 100644 --- a/src/MageTest/PhpSpec/MagentoExtension/CodeGenerator/Generator/Xml/ConfigGenerator.php +++ b/src/MageTest/PhpSpec/MagentoExtension/CodeGenerator/Generator/Xml/ConfigGenerator.php @@ -80,7 +80,7 @@ private function getDirectoryPath($moduleName) private function getCurrentConfigXml($moduleName) { - if (!$this->moduleFileExists($moduleName)) { + if (!$this->moduleFileExists()) { $values = array( '%module_name%' => $moduleName ); From 21ce8c420565e634cf20696d946f08f249273bd3 Mon Sep 17 00:00:00 2001 From: Shane Auckland Date: Fri, 26 Jun 2015 14:19:34 +0100 Subject: [PATCH 2/2] Throw exception if XML object cannot convert to string --- .../CodeGenerator/Generator/Xml/ConfigGenerator.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/MageTest/PhpSpec/MagentoExtension/CodeGenerator/Generator/Xml/ConfigGenerator.php b/src/MageTest/PhpSpec/MagentoExtension/CodeGenerator/Generator/Xml/ConfigGenerator.php index b9f431a..bbec3af 100644 --- a/src/MageTest/PhpSpec/MagentoExtension/CodeGenerator/Generator/Xml/ConfigGenerator.php +++ b/src/MageTest/PhpSpec/MagentoExtension/CodeGenerator/Generator/Xml/ConfigGenerator.php @@ -101,7 +101,13 @@ private function moduleFileExists() private function getIndentedXml(\SimpleXMLElement $xml) { - return $this->formatter->format($xml->asXML()); + $xmlText = $xml->asXML(); + + if (false === $xmlText) { + throw new \RuntimeException('Failed to convert XML object to string'); + } + + return $this->formatter->format($xmlText); } /**