diff --git a/src/Factory.php b/src/Factory.php index 6bdf2e0..376e54c 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -21,12 +21,14 @@ namespace Zend\Config; /** + * Declared abstract to prevent instantiation + * * @category Zend * @package Zend_Config * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Factory +abstract class Factory { /** * Readers used for config files. diff --git a/test/FactoryTest.php b/test/FactoryTest.php index 9e67929..c7fca77 100644 --- a/test/FactoryTest.php +++ b/test/FactoryTest.php @@ -74,16 +74,30 @@ public function testFromXmlFiles() $this->assertEquals('baz', $config['test']['bar']); } - public function testFromIniAndXmlFiles() + public function testFromPhpFiles() + { + $files = array ( + __DIR__ . '/TestAssets/Php/include-base.php', + __DIR__ . '/TestAssets/Php/include-base2.php' + ); + + $config = Factory::fromFiles($files); + $this->assertEquals('bar', $config['base']['foo']); + $this->assertEquals('baz', $config['test']['bar']); + } + + public function testFromIniAndXmlAndPhpFiles() { $files = array ( __DIR__ . '/TestAssets/Ini/include-base.ini', - __DIR__ . '/TestAssets/Xml/include-base2.xml' + __DIR__ . '/TestAssets/Xml/include-base2.xml', + __DIR__ . '/TestAssets/Php/include-base3.php', ); $config = Factory::fromFiles($files); $this->assertEquals('bar', $config['base']['foo']); $this->assertEquals('baz', $config['test']['bar']); + $this->assertEquals('baz', $config['last']['bar']); } public function testNonExistentFileThrowsRuntimeException() diff --git a/test/TestAssets/Php/include-base.php b/test/TestAssets/Php/include-base.php new file mode 100644 index 0000000..f773522 --- /dev/null +++ b/test/TestAssets/Php/include-base.php @@ -0,0 +1,6 @@ + array( + 'bar' => 'baz', + ), +); diff --git a/test/TestAssets/Php/include-base2.php b/test/TestAssets/Php/include-base2.php new file mode 100644 index 0000000..a870592 --- /dev/null +++ b/test/TestAssets/Php/include-base2.php @@ -0,0 +1,6 @@ + array( + 'foo' => 'bar', + ), +); diff --git a/test/TestAssets/Php/include-base3.php b/test/TestAssets/Php/include-base3.php new file mode 100644 index 0000000..04fa19b --- /dev/null +++ b/test/TestAssets/Php/include-base3.php @@ -0,0 +1,6 @@ + array( + 'bar' => 'baz', + ), +);