From ee7f63cc213f7d4c19961178558ab925ba450c50 Mon Sep 17 00:00:00 2001 From: Sandro Keil Date: Tue, 29 Apr 2014 18:20:10 +0100 Subject: [PATCH 1/3] updated source to psr-4, optimized tests --- .scrutinizer.yml | 16 +- .travis.yml | 7 +- CHANGELOG.md | 11 ++ Module.php | 10 -- composer.json | 8 +- phpunit.xml.dist | 11 +- config/module.config.php => src/Module.php | 7 +- src/Sake/EasyConfig/Module.php | 28 ---- .../Service/AbstractConfigurableFactory.php | 0 ...AbstractConstructorOptionConfigFactory.php | 0 .../AbstractOptionHydratorConfigFactory.php | 0 .../Service/AbstractServiceConfigFactory.php | 0 .../AbstractServiceManagerConfigFactory.php | 0 .../AbstractServiceOptionConfigFactory.php | 0 .../Service/ClassNameInterface.php | 0 .../Service/ConfigurableInterface.php | 0 .../Service/Exception/ExceptionInterface.php | 0 .../Service/Exception/RuntimeException.php | 0 .../Service/InjectionMethodInterface.php | 0 .../Service/OptionsClassInterface.php | 0 test/Bootstrap.php | 24 +++ .../Service/AbstractBaseTestCase.php | 29 +++- .../AbstractConfigurableFactoryTest.php | 6 +- ...ractConstructorOptionConfigFactoryTest.php | 5 +- ...bstractOptionHydratorConfigFactoryTest.php | 6 +- .../AbstractServiceConfigFactoryTest.php | 6 +- ...bstractServiceManagerConfigFactoryTest.php | 6 +- ...AbstractServiceOptionConfigFactoryTest.php | 6 +- .../TestAsset/AbstractOptionClassFactory.php | 2 +- .../Service/TestAsset/Container.php | 2 +- .../Service/TestAsset/InvalidClass.php | 2 +- .../Service/TestAsset/MyPluginManager.php | 2 +- .../TestAsset/MyPluginManagerFactory.php | 2 +- .../TestAsset/MyPluginManagerOptions.php | 2 +- .../Service/TestAsset/OptionClass.php | 2 +- .../Service/TestAsset/OptionConfig.php | 2 +- {tests => test}/TestConfig.php.dist | 1 - {tests => test}/testing.config.php | 0 tests/Bootstrap.php | 153 ------------------ .../EasyConfig/Service/ModuleTest.php | 37 ----- 40 files changed, 120 insertions(+), 273 deletions(-) delete mode 100644 Module.php rename config/module.config.php => src/Module.php (79%) delete mode 100644 src/Sake/EasyConfig/Module.php rename src/{Sake/EasyConfig => }/Service/AbstractConfigurableFactory.php (100%) rename src/{Sake/EasyConfig => }/Service/AbstractConstructorOptionConfigFactory.php (100%) rename src/{Sake/EasyConfig => }/Service/AbstractOptionHydratorConfigFactory.php (100%) rename src/{Sake/EasyConfig => }/Service/AbstractServiceConfigFactory.php (100%) rename src/{Sake/EasyConfig => }/Service/AbstractServiceManagerConfigFactory.php (100%) rename src/{Sake/EasyConfig => }/Service/AbstractServiceOptionConfigFactory.php (100%) rename src/{Sake/EasyConfig => }/Service/ClassNameInterface.php (100%) rename src/{Sake/EasyConfig => }/Service/ConfigurableInterface.php (100%) rename src/{Sake/EasyConfig => }/Service/Exception/ExceptionInterface.php (100%) rename src/{Sake/EasyConfig => }/Service/Exception/RuntimeException.php (100%) rename src/{Sake/EasyConfig => }/Service/InjectionMethodInterface.php (100%) rename src/{Sake/EasyConfig => }/Service/OptionsClassInterface.php (100%) create mode 100644 test/Bootstrap.php rename tests/SakeTest/Util/TestCase.php => test/Service/AbstractBaseTestCase.php (59%) rename {tests/SakeTest/EasyConfig => test}/Service/AbstractConfigurableFactoryTest.php (93%) rename {tests/SakeTest/EasyConfig => test}/Service/AbstractConstructorOptionConfigFactoryTest.php (93%) rename {tests/SakeTest/EasyConfig => test}/Service/AbstractOptionHydratorConfigFactoryTest.php (90%) rename {tests/SakeTest/EasyConfig => test}/Service/AbstractServiceConfigFactoryTest.php (93%) rename {tests/SakeTest/EasyConfig => test}/Service/AbstractServiceManagerConfigFactoryTest.php (94%) rename {tests/SakeTest/EasyConfig => test}/Service/AbstractServiceOptionConfigFactoryTest.php (93%) rename {tests/SakeTest/EasyConfig => test}/Service/TestAsset/AbstractOptionClassFactory.php (89%) rename {tests/SakeTest/EasyConfig => test}/Service/TestAsset/Container.php (90%) rename {tests/SakeTest/EasyConfig => test}/Service/TestAsset/InvalidClass.php (85%) rename {tests/SakeTest/EasyConfig => test}/Service/TestAsset/MyPluginManager.php (97%) rename {tests/SakeTest/EasyConfig => test}/Service/TestAsset/MyPluginManagerFactory.php (94%) rename {tests/SakeTest/EasyConfig => test}/Service/TestAsset/MyPluginManagerOptions.php (97%) rename {tests/SakeTest/EasyConfig => test}/Service/TestAsset/OptionClass.php (94%) rename {tests/SakeTest/EasyConfig => test}/Service/TestAsset/OptionConfig.php (95%) rename {tests => test}/TestConfig.php.dist (96%) rename {tests => test}/testing.config.php (100%) delete mode 100644 tests/Bootstrap.php delete mode 100644 tests/SakeTest/EasyConfig/Service/ModuleTest.php diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 37147b4..88dfcff 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -4,36 +4,34 @@ before_commands: tools: php_code_coverage: enabled: true - test_command: phpunit -c phpunit.xml.dist - #filter: - #paths: ["src"] + test_command: ./vendor/bin/phpunit -c phpunit.xml.dist php_code_sniffer: enabled: true config: standard: PSR2 filter: - paths: ["src/*", "tests/*"] + paths: ["src/*", "test/*"] php_cpd: enabled: true - excluded_dirs: ["build/*", "docs", "examples", "tests", "vendor"] + excluded_dirs: ["build/*", "docs", "test", "vendor"] php_cs_fixer: enabled: true config: level: all filter: - paths: ["src/*", "tests/*"] + paths: ["src/*", "test/*"] php_loc: enabled: true - excluded_dirs: ["build", "docs", "examples", "tests", "vendor"] + excluded_dirs: ["build", "docs", "test", "vendor"] php_mess_detector: enabled: true filter: paths: ["src/*"] php_pdepend: enabled: true - excluded_dirs: ["build", "docs", "examples", "tests", "vendor"] + excluded_dirs: ["build", "docs", "test", "vendor"] php_analyzer: true php_analyzer: filter: - paths: ["src/*", "tests/*", "examples/*"] + paths: ["src/*", "test/*"] sensiolabs_security_checker: true diff --git a/.travis.yml b/.travis.yml index db8a69c..10bab9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,11 @@ php: - 5.3 - 5.4 - 5.5 + - hhvm + +matrix: + allow_failures: + - php: hhvm before_script: - composer self-update @@ -11,7 +16,7 @@ before_script: script: - ./vendor/bin/phpunit - - ./vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/SakeTest + - ./vendor/bin/phpcs --standard=PSR2 ./src/ ./test after_script: - php vendor/bin/coveralls -v diff --git a/CHANGELOG.md b/CHANGELOG.md index f6d1e92..af03865 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # EasyConfig CHANGELOG +## 1.2.0 (2014-04-29) + +- Updated source to PSR-4 +- Removed Module.php +- Optimized tests + +## 1.1.0 (2014-04-03) + +- Optimized composer dependencies +- Updated docs + ## 1.0.0 (2013-11-25) - Initial release diff --git a/Module.php b/Module.php deleted file mode 100644 index 2717cb5..0000000 --- a/Module.php +++ /dev/null @@ -1,10 +0,0 @@ - - - ./tests/SakeTest/EasyConfig + ./test + ./test/Util/ - + ./config ./src - - + diff --git a/config/module.config.php b/src/Module.php similarity index 79% rename from config/module.config.php rename to src/Module.php index 9660a16..a755f8b 100644 --- a/config/module.config.php +++ b/src/Module.php @@ -9,4 +9,9 @@ namespace Sake\EasyConfig; -return array(); +/** + * This class initializes the EasyConfig module. + */ +class Module +{ +} diff --git a/src/Sake/EasyConfig/Module.php b/src/Sake/EasyConfig/Module.php deleted file mode 100644 index 0470ed5..0000000 --- a/src/Sake/EasyConfig/Module.php +++ /dev/null @@ -1,28 +0,0 @@ -serviceManager = Bootstrap::getServiceManager(); + + // Load the user-defined test configuration file, if it exists; otherwise, load default + if (is_readable('test/TestConfig.php')) { + $testConfig = require 'test/TestConfig.php'; + } else { + $testConfig = require 'test/TestConfig.php.dist'; + } + $this->moduleLoader = new ModuleLoader($testConfig); + $this->serviceManager = $this->moduleLoader->getServiceManager(); } /** diff --git a/tests/SakeTest/EasyConfig/Service/AbstractConfigurableFactoryTest.php b/test/Service/AbstractConfigurableFactoryTest.php similarity index 93% rename from tests/SakeTest/EasyConfig/Service/AbstractConfigurableFactoryTest.php rename to test/Service/AbstractConfigurableFactoryTest.php index dcd9d57..51e5058 100644 --- a/tests/SakeTest/EasyConfig/Service/AbstractConfigurableFactoryTest.php +++ b/test/Service/AbstractConfigurableFactoryTest.php @@ -3,18 +3,20 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ namespace SakeTest\EasyConfig\Service; +use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; + /** * Class AbstractConfigurableFactoryTest * * Tests integrity of \Sake\EasyConfig\Service\AbstractConfigurableFactory */ -class AbstractConfigurableFactoryTest extends \SakeTest\Util\TestCase +class AbstractConfigurableFactoryAbstractBaseTest extends BaseTestCase { /** * Class under test diff --git a/tests/SakeTest/EasyConfig/Service/AbstractConstructorOptionConfigFactoryTest.php b/test/Service/AbstractConstructorOptionConfigFactoryTest.php similarity index 93% rename from tests/SakeTest/EasyConfig/Service/AbstractConstructorOptionConfigFactoryTest.php rename to test/Service/AbstractConstructorOptionConfigFactoryTest.php index f4523d0..52abde0 100644 --- a/tests/SakeTest/EasyConfig/Service/AbstractConstructorOptionConfigFactoryTest.php +++ b/test/Service/AbstractConstructorOptionConfigFactoryTest.php @@ -3,12 +3,13 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ namespace SakeTest\EasyConfig\Service; +use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; use \Sake\EasyConfig\Service\AbstractConstructorOptionConfigFactory; /** @@ -16,7 +17,7 @@ * * Tests integrity of \Sake\EasyConfig\Service\AbstractConstructorOptionConfigFactory */ -class AbstractConstructorOptionConfigFactoryTest extends \SakeTest\Util\TestCase +class AbstractConstructorOptionConfigFactoryAbstractBaseTest extends BaseTestCase { /** * Class under test diff --git a/tests/SakeTest/EasyConfig/Service/AbstractOptionHydratorConfigFactoryTest.php b/test/Service/AbstractOptionHydratorConfigFactoryTest.php similarity index 90% rename from tests/SakeTest/EasyConfig/Service/AbstractOptionHydratorConfigFactoryTest.php rename to test/Service/AbstractOptionHydratorConfigFactoryTest.php index e539aa2..e9aa2a6 100644 --- a/tests/SakeTest/EasyConfig/Service/AbstractOptionHydratorConfigFactoryTest.php +++ b/test/Service/AbstractOptionHydratorConfigFactoryTest.php @@ -3,18 +3,20 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ namespace SakeTest\EasyConfig\Service; +use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; + /** * Class AbstractOptionHydratorConfigFactoryTest * * Tests integrity of \Sake\EasyConfig\Service\AbstractOptionHydratorConfigFactory */ -class AbstractOptionHydratorConfigFactoryTest extends \SakeTest\Util\TestCase +class AbstractOptionHydratorConfigFactoryAbstractBaseTest extends BaseTestCase { /** * Class under test diff --git a/tests/SakeTest/EasyConfig/Service/AbstractServiceConfigFactoryTest.php b/test/Service/AbstractServiceConfigFactoryTest.php similarity index 93% rename from tests/SakeTest/EasyConfig/Service/AbstractServiceConfigFactoryTest.php rename to test/Service/AbstractServiceConfigFactoryTest.php index 522d27f..3a4bc87 100644 --- a/tests/SakeTest/EasyConfig/Service/AbstractServiceConfigFactoryTest.php +++ b/test/Service/AbstractServiceConfigFactoryTest.php @@ -3,18 +3,20 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ namespace SakeTest\EasyConfig\Service; +use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; + /** * Class AbstractServiceConfigFactoryTest * * Tests integrity of \Sake\EasyConfig\Service\AbstractServiceConfigFactory */ -class AbstractServiceConfigFactoryTest extends \SakeTest\Util\TestCase +class AbstractServiceConfigFactoryAbstractBaseTest extends BaseTestCase { /** * Class under test diff --git a/tests/SakeTest/EasyConfig/Service/AbstractServiceManagerConfigFactoryTest.php b/test/Service/AbstractServiceManagerConfigFactoryTest.php similarity index 94% rename from tests/SakeTest/EasyConfig/Service/AbstractServiceManagerConfigFactoryTest.php rename to test/Service/AbstractServiceManagerConfigFactoryTest.php index 85f50a5..25c87d2 100644 --- a/tests/SakeTest/EasyConfig/Service/AbstractServiceManagerConfigFactoryTest.php +++ b/test/Service/AbstractServiceManagerConfigFactoryTest.php @@ -3,18 +3,20 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ namespace SakeTest\EasyConfig\Service; +use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; + /** * Class ServiceManagerConfigFactoryTest * * Tests integrity of \Sake\EasyConfig\Service\AbstractServiceManagerConfigFactory */ -class AbstractServiceManagerConfigFactoryTest extends \SakeTest\Util\TestCase +class AbstractServiceManagerConfigFactoryAbstractBaseTest extends BaseTestCase { /** * Class under test diff --git a/tests/SakeTest/EasyConfig/Service/AbstractServiceOptionConfigFactoryTest.php b/test/Service/AbstractServiceOptionConfigFactoryTest.php similarity index 93% rename from tests/SakeTest/EasyConfig/Service/AbstractServiceOptionConfigFactoryTest.php rename to test/Service/AbstractServiceOptionConfigFactoryTest.php index bc89b17..ffbcaad 100644 --- a/tests/SakeTest/EasyConfig/Service/AbstractServiceOptionConfigFactoryTest.php +++ b/test/Service/AbstractServiceOptionConfigFactoryTest.php @@ -3,18 +3,20 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ namespace SakeTest\EasyConfig\Service; +use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; + /** * Class AbstractServiceConfigFactoryTest * * Tests integrity of \Sake\EasyConfig\Service\AbstractServiceOptionConfigFactory */ -class AbstractServiceOptionConfigFactoryTest extends \SakeTest\Util\TestCase +class AbstractServiceOptionConfigFactoryAbstractBaseTest extends BaseTestCase { /** * Class under test diff --git a/tests/SakeTest/EasyConfig/Service/TestAsset/AbstractOptionClassFactory.php b/test/Service/TestAsset/AbstractOptionClassFactory.php similarity index 89% rename from tests/SakeTest/EasyConfig/Service/TestAsset/AbstractOptionClassFactory.php rename to test/Service/TestAsset/AbstractOptionClassFactory.php index eabe7bd..d88cc1d 100644 --- a/tests/SakeTest/EasyConfig/Service/TestAsset/AbstractOptionClassFactory.php +++ b/test/Service/TestAsset/AbstractOptionClassFactory.php @@ -3,7 +3,7 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ diff --git a/tests/SakeTest/EasyConfig/Service/TestAsset/Container.php b/test/Service/TestAsset/Container.php similarity index 90% rename from tests/SakeTest/EasyConfig/Service/TestAsset/Container.php rename to test/Service/TestAsset/Container.php index 3dbde8d..56cbcb1 100644 --- a/tests/SakeTest/EasyConfig/Service/TestAsset/Container.php +++ b/test/Service/TestAsset/Container.php @@ -3,7 +3,7 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ diff --git a/tests/SakeTest/EasyConfig/Service/TestAsset/InvalidClass.php b/test/Service/TestAsset/InvalidClass.php similarity index 85% rename from tests/SakeTest/EasyConfig/Service/TestAsset/InvalidClass.php rename to test/Service/TestAsset/InvalidClass.php index e7f76a8..7da16d1 100644 --- a/tests/SakeTest/EasyConfig/Service/TestAsset/InvalidClass.php +++ b/test/Service/TestAsset/InvalidClass.php @@ -3,7 +3,7 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ diff --git a/tests/SakeTest/EasyConfig/Service/TestAsset/MyPluginManager.php b/test/Service/TestAsset/MyPluginManager.php similarity index 97% rename from tests/SakeTest/EasyConfig/Service/TestAsset/MyPluginManager.php rename to test/Service/TestAsset/MyPluginManager.php index f6da58c..680f426 100644 --- a/tests/SakeTest/EasyConfig/Service/TestAsset/MyPluginManager.php +++ b/test/Service/TestAsset/MyPluginManager.php @@ -3,7 +3,7 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ diff --git a/tests/SakeTest/EasyConfig/Service/TestAsset/MyPluginManagerFactory.php b/test/Service/TestAsset/MyPluginManagerFactory.php similarity index 94% rename from tests/SakeTest/EasyConfig/Service/TestAsset/MyPluginManagerFactory.php rename to test/Service/TestAsset/MyPluginManagerFactory.php index 88a7167..1c99e78 100644 --- a/tests/SakeTest/EasyConfig/Service/TestAsset/MyPluginManagerFactory.php +++ b/test/Service/TestAsset/MyPluginManagerFactory.php @@ -3,7 +3,7 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ diff --git a/tests/SakeTest/EasyConfig/Service/TestAsset/MyPluginManagerOptions.php b/test/Service/TestAsset/MyPluginManagerOptions.php similarity index 97% rename from tests/SakeTest/EasyConfig/Service/TestAsset/MyPluginManagerOptions.php rename to test/Service/TestAsset/MyPluginManagerOptions.php index 2e2f201..7bad80d 100644 --- a/tests/SakeTest/EasyConfig/Service/TestAsset/MyPluginManagerOptions.php +++ b/test/Service/TestAsset/MyPluginManagerOptions.php @@ -3,7 +3,7 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ diff --git a/tests/SakeTest/EasyConfig/Service/TestAsset/OptionClass.php b/test/Service/TestAsset/OptionClass.php similarity index 94% rename from tests/SakeTest/EasyConfig/Service/TestAsset/OptionClass.php rename to test/Service/TestAsset/OptionClass.php index 82b00fb..d4a1ebe 100644 --- a/tests/SakeTest/EasyConfig/Service/TestAsset/OptionClass.php +++ b/test/Service/TestAsset/OptionClass.php @@ -3,7 +3,7 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ diff --git a/tests/SakeTest/EasyConfig/Service/TestAsset/OptionConfig.php b/test/Service/TestAsset/OptionConfig.php similarity index 95% rename from tests/SakeTest/EasyConfig/Service/TestAsset/OptionConfig.php rename to test/Service/TestAsset/OptionConfig.php index 8a72c83..5da3ed4 100644 --- a/tests/SakeTest/EasyConfig/Service/TestAsset/OptionConfig.php +++ b/test/Service/TestAsset/OptionConfig.php @@ -3,7 +3,7 @@ * Sake * * @link http://github.com/sandrokeil/EasyConfig for the canonical source repository - * @copyright Copyright (c) 2013 Sandro Keil + * @copyright Copyright (c) 2013-2014 Sandro Keil * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ diff --git a/tests/TestConfig.php.dist b/test/TestConfig.php.dist similarity index 96% rename from tests/TestConfig.php.dist rename to test/TestConfig.php.dist index 2f6f6fe..343acb3 100644 --- a/tests/TestConfig.php.dist +++ b/test/TestConfig.php.dist @@ -17,7 +17,6 @@ return array( ), 'module_paths' => array( 'src', - 'vendor', ), ), ); diff --git a/tests/testing.config.php b/test/testing.config.php similarity index 100% rename from tests/testing.config.php rename to test/testing.config.php diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php deleted file mode 100644 index 4b76e40..0000000 --- a/tests/Bootstrap.php +++ /dev/null @@ -1,153 +0,0 @@ - array( - 'module_paths' => explode(PATH_SEPARATOR, $zf2ModulePaths), - ), - ); - - $config = ArrayUtils::merge($baseConfig, $testConfig); - - $serviceManager = new ServiceManager(new ServiceManagerConfig()); - $serviceManager->setService('ApplicationConfig', $config); - $serviceManager->get('ModuleManager')->loadModules(); - - static::$serviceManager = $serviceManager; - static::$config = $config; - } - - /** - * @return ServiceManager - */ - public static function getServiceManager() - { - return static::$serviceManager; - } - - /** - * @return array - */ - public static function getConfig() - { - return static::$config; - } - - /** - * @throws \RuntimeException - */ - protected static function initAutoloader() - { - $vendorPath = static::findParentPath('vendor'); - - if (is_readable($vendorPath . '/autoload.php')) { - $loader = include $vendorPath . '/autoload.php'; - } else { - $zf2Path = getenv('ZF2_PATH') ?: (defined('ZF2_PATH') - ? ZF2_PATH : (is_dir($vendorPath . '/ZF2/library') ? $vendorPath . '/ZF2/library' : false)); - - if (!$zf2Path) { - throw new RuntimeException( - 'Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.' - ); - } - include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; - } - - AutoloaderFactory::factory(array( - 'Zend\Loader\StandardAutoloader' => array( - 'autoregister_zf' => true, - 'namespaces' => array( - __NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__, - ), - ), - )); - } - - /** - * @param $path - * @return bool|string - */ - protected static function findParentPath($path) - { - $dir = __DIR__; - $previousDir = '.'; - while (!is_dir($dir . '/' . $path)) { - $dir = dirname($dir); - if ($previousDir === $dir) { - return false; - } - $previousDir = $dir; - } - return $dir . '/' . $path; - } -} - -Bootstrap::init(); diff --git a/tests/SakeTest/EasyConfig/Service/ModuleTest.php b/tests/SakeTest/EasyConfig/Service/ModuleTest.php deleted file mode 100644 index 0604631..0000000 --- a/tests/SakeTest/EasyConfig/Service/ModuleTest.php +++ /dev/null @@ -1,37 +0,0 @@ -cut; - $config = $cut->getConfig(); - $this->assertSame(array(), $config, 'Configuration could not be read'); - } -} From 1fa319e1e0cdce157a89e40502ac33214c1c8eaf Mon Sep 17 00:00:00 2001 From: Sandro Keil Date: Tue, 29 Apr 2014 18:34:48 +0100 Subject: [PATCH 2/3] fixed namespace issue --- test/Service/AbstractBaseTestCase.php | 2 +- test/Service/AbstractConfigurableFactoryTest.php | 2 +- test/Service/AbstractConstructorOptionConfigFactoryTest.php | 4 ++-- test/Service/AbstractOptionHydratorConfigFactoryTest.php | 2 +- test/Service/AbstractServiceConfigFactoryTest.php | 2 +- test/Service/AbstractServiceManagerConfigFactoryTest.php | 2 +- test/Service/AbstractServiceOptionConfigFactoryTest.php | 2 +- test/Service/TestAsset/AbstractOptionClassFactory.php | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/Service/AbstractBaseTestCase.php b/test/Service/AbstractBaseTestCase.php index 2617c72..27d7e1e 100644 --- a/test/Service/AbstractBaseTestCase.php +++ b/test/Service/AbstractBaseTestCase.php @@ -7,7 +7,7 @@ * @license http://github.com/sandrokeil/EasyConfig/blob/master/LICENSE.txt New BSD License */ -namespace SakeTest\EasyConfig\Util; +namespace SakeTest\EasyConfig\Service; use Zend\Test\Util\ModuleLoader; use PHPUnit_Framework_TestCase as TestCase; diff --git a/test/Service/AbstractConfigurableFactoryTest.php b/test/Service/AbstractConfigurableFactoryTest.php index 51e5058..b053381 100644 --- a/test/Service/AbstractConfigurableFactoryTest.php +++ b/test/Service/AbstractConfigurableFactoryTest.php @@ -9,7 +9,7 @@ namespace SakeTest\EasyConfig\Service; -use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; +use SakeTest\EasyConfig\Service\AbstractBaseTestCase as BaseTestCase; /** * Class AbstractConfigurableFactoryTest diff --git a/test/Service/AbstractConstructorOptionConfigFactoryTest.php b/test/Service/AbstractConstructorOptionConfigFactoryTest.php index 52abde0..3b36727 100644 --- a/test/Service/AbstractConstructorOptionConfigFactoryTest.php +++ b/test/Service/AbstractConstructorOptionConfigFactoryTest.php @@ -9,8 +9,8 @@ namespace SakeTest\EasyConfig\Service; -use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; -use \Sake\EasyConfig\Service\AbstractConstructorOptionConfigFactory; +use SakeTest\EasyConfig\Service\AbstractBaseTestCase as BaseTestCase; +use Sake\EasyConfig\Service\AbstractConstructorOptionConfigFactory; /** * Class AbstractConstructorOptionConfigFactoryTest diff --git a/test/Service/AbstractOptionHydratorConfigFactoryTest.php b/test/Service/AbstractOptionHydratorConfigFactoryTest.php index e9aa2a6..10cbeca 100644 --- a/test/Service/AbstractOptionHydratorConfigFactoryTest.php +++ b/test/Service/AbstractOptionHydratorConfigFactoryTest.php @@ -9,7 +9,7 @@ namespace SakeTest\EasyConfig\Service; -use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; +use SakeTest\EasyConfig\Service\AbstractBaseTestCase as BaseTestCase; /** * Class AbstractOptionHydratorConfigFactoryTest diff --git a/test/Service/AbstractServiceConfigFactoryTest.php b/test/Service/AbstractServiceConfigFactoryTest.php index 3a4bc87..b254e16 100644 --- a/test/Service/AbstractServiceConfigFactoryTest.php +++ b/test/Service/AbstractServiceConfigFactoryTest.php @@ -9,7 +9,7 @@ namespace SakeTest\EasyConfig\Service; -use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; +use SakeTest\EasyConfig\Service\AbstractBaseTestCase as BaseTestCase; /** * Class AbstractServiceConfigFactoryTest diff --git a/test/Service/AbstractServiceManagerConfigFactoryTest.php b/test/Service/AbstractServiceManagerConfigFactoryTest.php index 25c87d2..cd2728c 100644 --- a/test/Service/AbstractServiceManagerConfigFactoryTest.php +++ b/test/Service/AbstractServiceManagerConfigFactoryTest.php @@ -9,7 +9,7 @@ namespace SakeTest\EasyConfig\Service; -use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; +use SakeTest\EasyConfig\Service\AbstractBaseTestCase as BaseTestCase; /** * Class ServiceManagerConfigFactoryTest diff --git a/test/Service/AbstractServiceOptionConfigFactoryTest.php b/test/Service/AbstractServiceOptionConfigFactoryTest.php index ffbcaad..44061df 100644 --- a/test/Service/AbstractServiceOptionConfigFactoryTest.php +++ b/test/Service/AbstractServiceOptionConfigFactoryTest.php @@ -9,7 +9,7 @@ namespace SakeTest\EasyConfig\Service; -use SakeTest\EasyConfig\Util\AbstractBaseTestCase as BaseTestCase; +use SakeTest\EasyConfig\Service\AbstractBaseTestCase as BaseTestCase; /** * Class AbstractServiceConfigFactoryTest diff --git a/test/Service/TestAsset/AbstractOptionClassFactory.php b/test/Service/TestAsset/AbstractOptionClassFactory.php index d88cc1d..ed6a736 100644 --- a/test/Service/TestAsset/AbstractOptionClassFactory.php +++ b/test/Service/TestAsset/AbstractOptionClassFactory.php @@ -9,7 +9,7 @@ namespace SakeTest\EasyConfig\Service\TestAsset; -use \Sake\EasyConfig\Service; +use Sake\EasyConfig\Service; abstract class AbstractOptionClassFactory extends Service\AbstractConfigurableFactory implements Service\OptionsClassInterface From f02d9be910b89c123ac745474ee144b2cbab39d4 Mon Sep 17 00:00:00 2001 From: Sandro Keil Date: Tue, 29 Apr 2014 19:47:22 +0100 Subject: [PATCH 3/3] updated readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a8195b6..52182f7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# EasyConfig module for Zend Framework 2 +# Easy Config module for Zend Framework 2 [![Build Status](https://travis-ci.org/sandrokeil/EasyConfig.png?branch=master)](https://travis-ci.org/sandrokeil/EasyConfig) [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/sandrokeil/EasyConfig/badges/quality-score.png?s=cdef161c14156e3e36ed0ce3d6fd7979d38d916c)](https://scrutinizer-ci.com/g/sandrokeil/EasyConfig/) [![Coverage Status](https://coveralls.io/repos/sandrokeil/EasyConfig/badge.png?branch=master)](https://coveralls.io/r/sandrokeil/EasyConfig?branch=master) @@ -6,11 +6,11 @@ [![Dependency Status](https://www.versioneye.com/user/projects/53245667ec13758e7d00014b/badge.png)](https://www.versioneye.com/user/projects/53245667ec13758e7d00014b) [![Total Downloads](https://poser.pugx.org/sandrokeil/easy-config/downloads.png)](https://packagist.org/packages/sandrokeil/easy-config) -Easy config provides some abstract factories to easily create instances depending on configuration or retrieve specified module options. +EasyConfig provides some abstract factories to easily create instances depending on configuration or retrieve specified module options. You should have coding conventions and you should have config conventions. If not, you should think about that. -This module config keys should have the following structure `module.scope.name`. A common configuration looks like that: +The module config keys should have the following structure `module.scope.name`. A common configuration looks like that: ```php return array(