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..b053381 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\Service\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 90% rename from tests/SakeTest/EasyConfig/Service/AbstractConstructorOptionConfigFactoryTest.php rename to test/Service/AbstractConstructorOptionConfigFactoryTest.php index f4523d0..3b36727 100644 --- a/tests/SakeTest/EasyConfig/Service/AbstractConstructorOptionConfigFactoryTest.php +++ b/test/Service/AbstractConstructorOptionConfigFactoryTest.php @@ -3,20 +3,21 @@ * 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 \Sake\EasyConfig\Service\AbstractConstructorOptionConfigFactory; +use SakeTest\EasyConfig\Service\AbstractBaseTestCase as BaseTestCase; +use Sake\EasyConfig\Service\AbstractConstructorOptionConfigFactory; /** * Class AbstractConstructorOptionConfigFactoryTest * * 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..10cbeca 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\Service\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..b254e16 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\Service\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..cd2728c 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\Service\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..44061df 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\Service\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 83% rename from tests/SakeTest/EasyConfig/Service/TestAsset/AbstractOptionClassFactory.php rename to test/Service/TestAsset/AbstractOptionClassFactory.php index eabe7bd..ed6a736 100644 --- a/tests/SakeTest/EasyConfig/Service/TestAsset/AbstractOptionClassFactory.php +++ b/test/Service/TestAsset/AbstractOptionClassFactory.php @@ -3,13 +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\TestAsset; -use \Sake\EasyConfig\Service; +use Sake\EasyConfig\Service; abstract class AbstractOptionClassFactory extends Service\AbstractConfigurableFactory implements Service\OptionsClassInterface 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'); - } -}