diff --git a/src/Config.php b/src/Config.php index c43bc50..50a88d6 100644 --- a/src/Config.php +++ b/src/Config.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config; @@ -21,9 +20,6 @@ * * Implements Countable, Iterator and ArrayAccess * to facilitate easy access to the data. - * - * @category Zend - * @package Zend_Config */ class Config implements Countable, Iterator, ArrayAccess { diff --git a/src/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php index 3c6a686..92272f8 100644 --- a/src/Exception/ExceptionInterface.php +++ b/src/Exception/ExceptionInterface.php @@ -5,15 +5,9 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Exception; -/** - * @category Zend - * @package Zend_Config - * @subpackage Exception - */ interface ExceptionInterface {} diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index 7670f0e..0d15e1f 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -5,15 +5,9 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Exception; -/** - * @category Zend - * @package Zend_Config - * @subpackage Exception - */ class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface {} diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index 31dc090..d91923c 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -5,15 +5,9 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Exception; -/** - * @category Zend - * @package Zend_Config - * @subpackage Exception - */ class RuntimeException extends \RuntimeException implements ExceptionInterface {} diff --git a/src/Factory.php b/src/Factory.php index 825f071..8639171 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config; use Zend\Stdlib\ArrayUtils; -/** - * @category Zend - * @package Zend_Config - */ class Factory { /** @@ -25,6 +20,13 @@ class Factory */ public static $readers = null; + /** + * Plugin manager for loading writers + * + * @var null|WriterPluginManager + */ + public static $writers = null; + /** * Registered config file extensions. * key is extension, value is reader instance or plugin name @@ -38,6 +40,19 @@ class Factory 'yaml' => 'yaml', ); + /** + * Register config file extensions for writing + * key is extension, value is writer instance or plugin name + * + * @var array + */ + protected static $writerExtensions = array( + 'php' => 'php', + 'ini' => 'ini', + 'json' => 'json', + 'xml' => 'xml', + 'yaml' => 'yaml', + ); /** * Read a config from a file. @@ -107,10 +122,67 @@ public static function fromFiles(array $files, $returnConfigObject = false) return ($returnConfigObject) ? new Config($config) : $config; } + /** + * Writes a config to a file + * + * @param string $filename + * @param array|Config $config + * @return boolean TRUE on success | FALSE on failure + * @throws Exception\RuntimeException + * @throws Exception\InvalidArgumentException + */ + public static function toFile($filename, $config) + { + if ( + (is_object($config) && !($config instanceOf Config)) || + (!is_object($config) && !is_array($config)) + ) { + throw new Exception\InvalidArgumentException( + __METHOD__." \$config should be an array or instance of Zend\\Config\\Config" + ); + } + + $extension = substr(strrchr($filename, '.'), 1); + $directory = dirname($filename); + + if (!is_dir($directory)) { + throw new Exception\RuntimeException( + "Directory '{$directory}' does not exists!" + ); + } + + if (!is_writable($directory)) { + throw new Exception\RuntimeException( + "Cannot write in directory '{$directory}'" + ); + } + + if(!isset(self::$writerExtensions[$extension])) { + throw new Exception\RuntimeException( + "Unsupported config file extension: '.{$extension}' for writing." + ); + } + + $writer = self::$writerExtensions[$extension]; + if (($writer instanceOf Writer\AbstractWriter) === false) { + $writer = self::getWriterPluginManager()->get($writer); + self::$writerExtensions[$extension] = $writer; + } + + if (is_object($config)) { + $config = $config->toArray(); + } + + $content = $writer->processConfig($config); + + return (bool) (file_put_contents($filename, $content) !== false); + } + /** * Set reader plugin manager * * @param ReaderPluginManager $readers + * @return void */ public static function setReaderPluginManager(ReaderPluginManager $readers) { @@ -130,12 +202,38 @@ public static function getReaderPluginManager() return static::$readers; } + /** + * Set writer plugin manager + * + * @param WriterPluginManager $writers + * @return void + */ + public static function setWriterPluginManager(WriterPluginManager $writers) + { + self::$writers = $writers; + } + + /** + * Get the writer plugin manager + * + * @return WriterPluginManager + */ + public static function getWriterPluginManager() + { + if (static::$writers === null) { + static::$writers = new WriterPluginManager(); + } + + return static::$writers; + } + /** * Set config reader for file extension * * @param string $extension * @param string|Reader\ReaderInterface $reader * @throws Exception\InvalidArgumentException + * @return void */ public static function registerReader($extension, $reader) { @@ -152,4 +250,28 @@ public static function registerReader($extension, $reader) static::$extensions[$extension] = $reader; } + + /** + * Set config writer for file extension + * + * @param string $extension + * @param string|Writer\AbstractWriter $writer + * @throw Exception\InvalidArgumentException + * @return void + */ + public static function registerWriter($extension, $writer) + { + $extension = strtolower($extension); + + if (!is_string($writer) && !$writer instanceof Writer\AbstractWriter) { + throw new Exception\InvalidArgumentException(sprintf( + 'Writer should be plugin name, class name or ' . + 'instance of %s\Writer\AbstractWriter; received "%s"', + __NAMESPACE__, + (is_object($writer) ? get_class($writer) : gettype($writer)) + )); + } + + self::$writerExtensions[$extension] = $writer; + } } diff --git a/src/Processor/Constant.php b/src/Processor/Constant.php index afea89f..265c937 100644 --- a/src/Processor/Constant.php +++ b/src/Processor/Constant.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Processor; -/** - * @category Zend - * @package Zend_Config - * @subpackage Processor - */ class Constant extends Token implements ProcessorInterface { /** diff --git a/src/Processor/Filter.php b/src/Processor/Filter.php index 0d4696a..7740a26 100644 --- a/src/Processor/Filter.php +++ b/src/Processor/Filter.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Processor; @@ -14,11 +13,6 @@ use Zend\Config\Exception; use Zend\Filter\FilterInterface as ZendFilter; -/** - * @category Zend - * @package Zend_Config - * @subpackage Processor - */ class Filter implements ProcessorInterface { /** diff --git a/src/Processor/ProcessorInterface.php b/src/Processor/ProcessorInterface.php index 9ddbe15..aafe099 100644 --- a/src/Processor/ProcessorInterface.php +++ b/src/Processor/ProcessorInterface.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Processor; use Zend\Config\Config; -/** - * @category Zend - * @package Zend_Config - * @subpackage Processor - */ interface ProcessorInterface { /** diff --git a/src/Processor/Queue.php b/src/Processor/Queue.php index 8674346..386e251 100644 --- a/src/Processor/Queue.php +++ b/src/Processor/Queue.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Processor; @@ -14,11 +13,6 @@ use Zend\Config\Exception; use Zend\Stdlib\PriorityQueue; -/** - * @category Zend - * @package Zend_Config - * @subpackage Processor - */ class Queue extends PriorityQueue implements ProcessorInterface { /** diff --git a/src/Processor/Token.php b/src/Processor/Token.php index 42e620c..fb85b53 100644 --- a/src/Processor/Token.php +++ b/src/Processor/Token.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Processor; @@ -14,11 +13,6 @@ use Zend\Config\Config; use Zend\Config\Exception; -/** - * @category Zend - * @package Zend_Config - * @subpackage Processor - */ class Token implements ProcessorInterface { /** diff --git a/src/Processor/Translator.php b/src/Processor/Translator.php index bf272a8..db9691d 100644 --- a/src/Processor/Translator.php +++ b/src/Processor/Translator.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Processor; @@ -14,11 +13,6 @@ use Zend\Config\Exception; use Zend\I18n\Translator\Translator as ZendTranslator; -/** - * @category Zend - * @package Zend_Config - * @subpackage Processor - */ class Translator implements ProcessorInterface { /** diff --git a/src/Reader/Ini.php b/src/Reader/Ini.php index ffb31a8..3b4ea76 100644 --- a/src/Reader/Ini.php +++ b/src/Reader/Ini.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Reader; @@ -14,10 +13,6 @@ /** * XML config reader. - * - * @category Zend - * @package Zend_Config - * @subpackage Reader */ class Ini implements ReaderInterface { diff --git a/src/Reader/Json.php b/src/Reader/Json.php index ec8e416..3166e6b 100644 --- a/src/Reader/Json.php +++ b/src/Reader/Json.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Reader; @@ -16,10 +15,6 @@ /** * JSON config reader. - * - * @category Zend - * @package Zend_Config - * @subpackage Reader */ class Json implements ReaderInterface { diff --git a/src/Reader/ReaderInterface.php b/src/Reader/ReaderInterface.php index 55d76a9..9061c57 100644 --- a/src/Reader/ReaderInterface.php +++ b/src/Reader/ReaderInterface.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Reader; -/** - * @category Zend - * @package Zend_Config - * @subpackage Reader - */ interface ReaderInterface { /** diff --git a/src/Reader/Xml.php b/src/Reader/Xml.php index 24ccd10..ad81764 100644 --- a/src/Reader/Xml.php +++ b/src/Reader/Xml.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Reader; @@ -15,10 +14,6 @@ /** * XML config reader. - * - * @category Zend - * @package Zend_Config - * @subpackage Reader */ class Xml implements ReaderInterface { diff --git a/src/Reader/Yaml.php b/src/Reader/Yaml.php index 057f944..9ccbb96 100644 --- a/src/Reader/Yaml.php +++ b/src/Reader/Yaml.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Reader; @@ -14,10 +13,6 @@ /** * YAML config reader. - * - * @category Zend - * @package Zend_Config - * @subpackage Reader */ class Yaml implements ReaderInterface { diff --git a/src/ReaderPluginManager.php b/src/ReaderPluginManager.php index 112c2ee..8b0a3ee 100644 --- a/src/ReaderPluginManager.php +++ b/src/ReaderPluginManager.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config; use Zend\ServiceManager\AbstractPluginManager; -/** - * @category Zend - * @package Zend_Config - */ class ReaderPluginManager extends AbstractPluginManager { /** diff --git a/src/Writer/AbstractWriter.php b/src/Writer/AbstractWriter.php index be48c21..881eb75 100644 --- a/src/Writer/AbstractWriter.php +++ b/src/Writer/AbstractWriter.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Writer; @@ -14,11 +13,6 @@ use Zend\Config\Exception; use Zend\Stdlib\ArrayUtils; -/** - * @category Zend - * @package Zend_Config - * @subpackage Writer - */ abstract class AbstractWriter implements WriterInterface { /** diff --git a/src/Writer/Ini.php b/src/Writer/Ini.php index a516f11..c8a16c7 100644 --- a/src/Writer/Ini.php +++ b/src/Writer/Ini.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Writer; use Zend\Config\Exception; -/** - * @category Zend - * @package Zend_Config - * @subpackage Writer - */ class Ini extends AbstractWriter { /** diff --git a/src/Writer/Json.php b/src/Writer/Json.php index 759d7c5..4048ee8 100644 --- a/src/Writer/Json.php +++ b/src/Writer/Json.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Writer; use Zend\Json\Json as JsonFormat; -/** - * @category Zend - * @package Zend_Config - * @subpackage Writer - */ class Json extends AbstractWriter { /** diff --git a/src/Writer/PhpArray.php b/src/Writer/PhpArray.php index 1e8a833..478a006 100644 --- a/src/Writer/PhpArray.php +++ b/src/Writer/PhpArray.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Writer; -/** - * @category Zend - * @package Zend_Config - * @subpackage Writer - */ class PhpArray extends AbstractWriter { /** diff --git a/src/Writer/WriterInterface.php b/src/Writer/WriterInterface.php index 755d3dd..d121b88 100644 --- a/src/Writer/WriterInterface.php +++ b/src/Writer/WriterInterface.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Writer; -/** - * @category Zend - * @package Zend_Config - * @subpackage Writer - */ interface WriterInterface { /** diff --git a/src/Writer/Xml.php b/src/Writer/Xml.php index 42e93d2..41a5ca5 100644 --- a/src/Writer/Xml.php +++ b/src/Writer/Xml.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Writer; @@ -13,11 +12,6 @@ use XMLWriter; use Zend\Config\Exception; -/** - * @category Zend - * @package Zend_Config - * @subpackage Writer - */ class Xml extends AbstractWriter { /** diff --git a/src/Writer/Yaml.php b/src/Writer/Yaml.php index 55e88d4..be2aa07 100644 --- a/src/Writer/Yaml.php +++ b/src/Writer/Yaml.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Config */ namespace Zend\Config\Writer; use Zend\Config\Exception; -/** - * @category Zend - * @package Zend_Config - * @subpackage Writer - */ class Yaml extends AbstractWriter { /** diff --git a/src/WriterPluginManager.php b/src/WriterPluginManager.php new file mode 100755 index 0000000..35717f5 --- /dev/null +++ b/src/WriterPluginManager.php @@ -0,0 +1,29 @@ + 'Zend\Config\Writer\PhpArray', + 'ini' => 'Zend\Config\Writer\Ini', + 'json' => 'Zend\Config\Writer\Json', + 'yaml' => 'Zend\Config\Writer\Yaml', + 'xml' => 'Zend\Config\Writer\Xml', + ); + + public function validatePlugin($plugin) + { + if ($plugin instanceOf Writer\AbstractWriter) { + return; + } + + $type = is_object($plugin) ? get_class($plugin) : gettype($plugin); + + throw new Exception\InvalidArgumentException( + "Plugin of type {$type} is invalid. Plugin must extend ". + __NAMESPACE__.'\Writer\AbstractWriter' + ); + } +} diff --git a/test/FactoryTest.php b/test/FactoryTest.php index b78abe2..ee70b8e 100644 --- a/test/FactoryTest.php +++ b/test/FactoryTest.php @@ -20,6 +20,28 @@ */ class FactoryTest extends \PHPUnit_Framework_TestCase { + protected $tmpFiles = array(); + + protected function getTestAssetFileName($ext) + { + if (empty($this->tmpfiles[$ext])) { + $this->tmpfiles[$ext] = tempnam(sys_get_temp_dir(), 'zend-config-writer').'.'.$ext; + } + return $this->tmpfiles[$ext]; + } + + public function tearDown() + { + foreach($this->tmpFiles as $file) { + if (file_exists($file)) { + if (!is_writable($file)) { + chmod($file, 0777); + } + @unlink($file); + } + } + } + public function testFromIni() { $config = Factory::fromFile(__DIR__ . '/TestAssets/Ini/include-base.ini'); @@ -125,7 +147,7 @@ public function testFactoryCanRegisterCustomReaderInstance() $this->assertEquals($configObject['one'], 1); } - public function testFactoryCanRegisterCustomReaderPlugn() + public function testFactoryCanRegisterCustomReaderPlugin() { $dummyReader = new Reader\TestAssets\DummyReader(); Factory::getReaderPluginManager()->setService('DummyReader', $dummyReader); @@ -138,5 +160,73 @@ public function testFactoryCanRegisterCustomReaderPlugn() $this->assertEquals($configObject['one'], 1); } + public function testFactoryToFileInvalidFileExtension() + { + $this->setExpectedException('RuntimeException'); + $result = Factory::toFile(__DIR__.'/TestAssets/bad.ext', array()); + } + + public function testFactoryToFileNoDirInHere() + { + $this->setExpectedException('RuntimeException'); + $result = Factory::toFile(__DIR__.'/TestAssets/NoDirInHere/nonExisiting/dummy.php', array()); + } + + public function testFactoryWriteToFile() + { + $config = array('test' => 'foo', 'bar' => array(0 => 'baz', 1 => 'foo')); + + $file = $this->getTestAssetFileName('php'); + $result = Factory::toFile($file, $config); + + // build string line by line as we are trailing-whitespace sensitive. + $expected = " 'foo',\n"; + $expected .= " 'bar' => \n"; + $expected .= " array (\n"; + $expected .= " 0 => 'baz',\n"; + $expected .= " 1 => 'foo',\n"; + $expected .= " ),\n"; + $expected .= ");\n"; + + $this->assertEquals(true, $result); + $this->assertEquals($expected, file_get_contents($file)); + } + + public function testFactoryToFileWrongConfig() + { + $this->setExpectedException('InvalidArgumentException'); + $result = Factory::toFile('test.ini', 'Im wrong'); + } + + public function testFactoryRegisterInvalidWriter() + { + $this->setExpectedException('InvalidArgumentException'); + Factory::registerWriter('dum', new Reader\TestAssets\DummyReader()); + } + + public function testFactoryCanRegisterCustomWriterInstance() + { + Factory::registerWriter('dum', new Writer\TestAssets\DummyWriter()); + + $file = $this->getTestAssetFileName('dum'); + $res = Factory::toFile($file, array('one' => 1)); + + $this->assertEquals($res, true); + } + + public function testFactoryCanRegisterCustomWriterPlugin() + { + $dummyWriter = new Writer\TestAssets\DummyWriter(); + Factory::getWriterPluginManager()->setService('DummyWriter', $dummyWriter); + + Factory::registerWriter('dum', 'DummyWriter'); + + $file = $this->getTestAssetFileName('dum'); + + $res = Factory::toFile($file, array('one' => 1)); + $this->assertEquals($res, true); + } } diff --git a/test/Writer/TestAssets/DummyWriter.php b/test/Writer/TestAssets/DummyWriter.php new file mode 100755 index 0000000..d5a989c --- /dev/null +++ b/test/Writer/TestAssets/DummyWriter.php @@ -0,0 +1,22 @@ +