Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into ValidatorMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
Matej Szendi committed Nov 4, 2013
173 parents 47ff527 + 33b5707 + 0f253b5 + 644d22a + f3cba00 + e470732 + ae8cd95 + a4f21b6 + f36ff90 + 5344247 + 5cdfa08 + 4925e55 + fb107e5 + 98634df + 8d23ab7 + 19e17a6 + 98ac67f + 0a2d51c + 86db540 + efbb513 + 24c143c + 307427e + 4c7a822 + 25d3bd7 + 40bfe7f + 70ca2ff + 76fd684 + 82cff31 + 186a39c + 39a35fe + b0c8193 + 1a7e426 + 09ea754 + 8317963 + 950705c + bd78289 + 25f3e05 + 1c0577b + 6bcfccb + 0b2a1a9 + 7974490 + f3ba45e + 4357e80 + 7d43d02 + 421a0f4 + e7aa329 + 6d05bfe + f27c5e2 + 6cb3b21 + 1ecb5ed + b66b0e2 + 0b91e40 + 6bda391 + b932fa5 + a431b75 + 9ce83ec + a35dff6 + 60e4965 + 0f071e9 + 3fe17b4 + 196ca18 + 17cbc64 + 8f4a51f + 88ec12d + 31ab35e + 59c83c4 + d50da4c + 01af50b + 6a46af5 + 4308adc + 1c3d629 + 18a268d + 1987408 + abc72db + 175f7ab + 8a85704 + 7706019 + cc5d38c + fbaa5aa + 0555415 + 20ae04b + 0680687 + e65301c + 424e30a + d36a7f1 + 64bb794 + c74649b + b14bb6b + 4e73e4e + 0ee93d0 + e887bfd + f66ad20 + 66c5ff2 + f5b2841 + 717175b + 52c5e49 + 8f39d69 + 2003fce + 1ccb3fd + 315a9ac + 2b82c0f + 1565409 + fd7399e + cb27129 + 62ca6c9 + 7b73995 + 18f93e0 + 72fe59b + 9f5b116 + 28a04a3 + b56ee4d + 9287e61 + 1a420ec + 6a43cc1 + ad11b96 + cf95523 + 25ef603 + 894f762 + c00c005 + 69fb7fc + 57cb4a0 + e25b09c + 17a7c5c + c526cd4 + 518ca6f + 57fa76c + 853c28f + 520cebc + dc5f609 + ccf1c7e + 251b79e + 78fbb55 + fcc04e7 + 9bf2948 + 9561532 + b614ad3 + 954a3b1 + dacc257 + 07a262d + 59c02c3 + 7064caa + 6f75739 + 747b7ed + eb24d30 + 8ff8298 + 97c61d8 + da4af46 + 11c9caf + cc11df8 + cd54577 + 298afbb + 24c5cf6 + fa546ac + 5e4d7a6 + cddbfdf + 7e73be1 + ecda841 + dc32703 + 9bb6302 + fee2498 + f827502 + 4b8d9e1 + eff3fbb + 240c93a + b3fb51a + c6bda54 + 6da2074 + 26ea7ff + 44bad20 + 3778e71 + c7f821e + fcfa508 + a57a7d5 commit 9082749
Show file tree
Hide file tree
Showing 20 changed files with 52 additions and 69 deletions.
2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Config implements Countable, Iterator, ArrayAccess
protected $count;

/**
* Data withing the configuration.
* Data within the configuration.
*
* @var array
*/
Expand Down
14 changes: 7 additions & 7 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ public static function toFile($filename, $config)
);
}

$extension = substr(strrchr($filename, '.'), 1);
$directory = dirname($filename);
$extension = substr(strrchr($filename, '.'), 1);
$directory = dirname($filename);

if (!is_dir($directory)) {
throw new Exception\RuntimeException(
Expand All @@ -157,16 +157,16 @@ public static function toFile($filename, $config)
);
}

if (!isset(self::$writerExtensions[$extension])) {
if (!isset(static::$writerExtensions[$extension])) {
throw new Exception\RuntimeException(
"Unsupported config file extension: '.{$extension}' for writing."
);
}

$writer = self::$writerExtensions[$extension];
$writer = static::$writerExtensions[$extension];
if (($writer instanceOf Writer\AbstractWriter) === false) {
$writer = self::getWriterPluginManager()->get($writer);
self::$writerExtensions[$extension] = $writer;
static::$writerExtensions[$extension] = $writer;
}

if (is_object($config)) {
Expand Down Expand Up @@ -210,7 +210,7 @@ public static function getReaderPluginManager()
*/
public static function setWriterPluginManager(WriterPluginManager $writers)
{
self::$writers = $writers;
static::$writers = $writers;
}

/**
Expand Down Expand Up @@ -272,6 +272,6 @@ public static function registerWriter($extension, $writer)
));
}

self::$writerExtensions[$extension] = $writer;
static::$writerExtensions[$extension] = $writer;
}
}
2 changes: 1 addition & 1 deletion src/WriterPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
class WriterPluginManager extends AbstractPluginManager
{
protected $invokableClasses = array(
'php' => 'Zend\Config\Writer\PhpArray',
'ini' => 'Zend\Config\Writer\Ini',
'json' => 'Zend\Config\Writer\Json',
'php' => 'Zend\Config\Writer\PhpArray',
'yaml' => 'Zend\Config\Writer\Yaml',
'xml' => 'Zend\Config\Writer\Xml',
);
Expand Down
4 changes: 0 additions & 4 deletions test/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* @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 ZendTest\Config;

use Zend\Config\Config;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
class ConfigTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* @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 ZendTest\Config;

use Zend\Config\Factory;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
class FactoryTest extends \PHPUnit_Framework_TestCase
Expand Down
45 changes: 41 additions & 4 deletions test/ProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ZendTest\Config;
Expand All @@ -23,9 +22,6 @@
use Zend\Filter\PregReplace;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
class ProcessorTest extends \PHPUnit_Framework_TestCase
Expand Down Expand Up @@ -333,6 +329,10 @@ public function testPHPConstants()

public function testTranslator()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$config = new Config($this->translatorData, true);
$translator = new Translator();
$translator->addTranslationFile('phparray', $this->translatorFile);
Expand All @@ -346,6 +346,23 @@ public function testTranslator()
$this->assertEquals('zwei Hunde', $config->pages[1]->label);
}

public function testTranslatorWithoutIntl()
{
if (extension_loaded('intl')) {
$this->markTestSkipped('ext/intl enabled');
}

$this->setExpectedException('Zend\I18n\Exception\ExtensionNotLoadedException',
'Zend\I18n\Translator component requires the intl PHP extension');

$config = new Config($this->translatorData, true);
$translator = new Translator();
$translator->addTranslationFile('phparray', $this->translatorFile);
$processor = new TranslatorProcessor($translator);

$processor->process($config);
}

public function testTranslatorReadOnly()
{
$config = new Config($this->translatorData, false);
Expand All @@ -359,6 +376,26 @@ public function testTranslatorReadOnly()

public function testTranslatorSingleValue()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$translator = new Translator();
$translator->addTranslationFile('phparray', $this->translatorFile);
$processor = new TranslatorProcessor($translator);

$this->assertEquals('ein Hund', $processor->processValue('one dog'));
}

public function testTranslatorSingleValueWithoutIntl()
{
if (extension_loaded('intl')) {
$this->markTestSkipped('ext/intl enabled');
}

$this->setExpectedException('Zend\I18n\Exception\ExtensionNotLoadedException',
'Zend\I18n\Translator component requires the intl PHP extension');

$translator = new Translator();
$translator->addTranslationFile('phparray', $this->translatorFile);
$processor = new TranslatorProcessor($translator);
Expand Down
4 changes: 0 additions & 4 deletions test/Reader/AbstractReaderTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ZendTest\Config\Reader;
Expand All @@ -14,9 +13,6 @@
use Zend\Config\Reader\ReaderInterface;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
abstract class AbstractReaderTestCase extends TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/Reader/IniTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* @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 ZendTest\Config\Reader;

use Zend\Config\Reader\Ini;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
class IniTest extends AbstractReaderTestCase
Expand Down
4 changes: 0 additions & 4 deletions test/Reader/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* @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 ZendTest\Config\Reader;

use Zend\Config\Reader\Json;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
class JsonTest extends AbstractReaderTestCase
Expand Down
1 change: 0 additions & 1 deletion test/Reader/TestAssets/DummyReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ZendTest\Config\Reader\TestAssets;
Expand Down
4 changes: 0 additions & 4 deletions test/Reader/XmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* @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 ZendTest\Config\Reader;

use Zend\Config\Reader\Xml;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
class XmlTest extends AbstractReaderTestCase
Expand Down
5 changes: 0 additions & 5 deletions test/Reader/YamlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,19 @@
* @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 ZendTest\Config\Reader;

use Zend\Config\Reader\Yaml as YamlReader;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
class YamlTest extends AbstractReaderTestCase
{
public function setUp()
{

if (!constant('TESTS_ZEND_CONFIG_YAML_ENABLED')) {
$this->markTestSkipped('Yaml test for Zend\Config skipped');
}
Expand Down
4 changes: 0 additions & 4 deletions test/Writer/AbstractWriterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ZendTest\Config\Writer;
Expand All @@ -14,9 +13,6 @@
use Zend\Config\Config;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
abstract class AbstractWriterTestCase extends TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/Writer/IniTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ZendTest\Config\Writer;
Expand All @@ -15,9 +14,6 @@
use Zend\Config\Reader\Ini as IniReader;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
class IniTest extends AbstractWriterTestCase
Expand Down
4 changes: 0 additions & 4 deletions test/Writer/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ZendTest\Config\Writer;
Expand All @@ -15,9 +14,6 @@
use Zend\Config\Reader\Json as JsonReader;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
class JsonTest extends AbstractWriterTestCase
Expand Down
4 changes: 0 additions & 4 deletions test/Writer/PhpArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ZendTest\Config\Writer;
Expand All @@ -15,9 +14,6 @@
use ZendTest\Config\Writer\TestAssets\PhpReader;

/**
* @category Zend
* @package Zend_Config
* @subpackage UnitTests
* @group Zend_Config
*/
class PhpArrayTest extends AbstractWriterTestCase
Expand Down
1 change: 0 additions & 1 deletion test/Writer/TestAssets/DummyWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ZendTest\Config\Writer\TestAssets;
Expand Down
1 change: 0 additions & 1 deletion test/Writer/TestAssets/PhpReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ZendTest\Config\Writer\TestAssets;
Expand Down
Loading

0 comments on commit 9082749

Please sign in to comment.