From 2be728038e5b623dc0aaa91fb77716b1ee7d6c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Thu, 5 Mar 2015 21:36:44 +0100 Subject: [PATCH 1/4] Updated testing dependencies --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f85b2c1..aaebb51 100644 --- a/composer.json +++ b/composer.json @@ -26,9 +26,9 @@ "nette/safe-stream": "@dev" }, "require-dev": { - "nette/tester": "~1.2", + "nette/tester": "~1.3", "janmarek/mockista": "~1.0", - "jakub-onderka/php-parallel-lint": "~0.7" + "jakub-onderka/php-parallel-lint": "~0.8" }, "suggest": { "kdyby/events": "Events for Nette Framework", From aa4a29409a28be431f22b95efb99c742f3f2538d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Thu, 5 Mar 2015 21:37:08 +0100 Subject: [PATCH 2/4] Simplified testing on Travis CI --- .travis.yml | 16 ++++++-------- tests/composer-nette-2.0.json | 35 ------------------------------ tests/composer-nette-2.1.json | 35 ------------------------------ tests/composer-nette-2.2.json | 40 ----------------------------------- tests/prepare-composer.php | 16 -------------- 5 files changed, 6 insertions(+), 136 deletions(-) delete mode 100644 tests/composer-nette-2.0.json delete mode 100644 tests/composer-nette-2.1.json delete mode 100644 tests/composer-nette-2.2.json delete mode 100644 tests/prepare-composer.php diff --git a/.travis.yml b/.travis.yml index 244a210..6007ef5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,5 @@ language: php -env: - - NETTE=default - - NETTE=nette-2.0 - - NETTE=nette-2.1 - - NETTE=nette-2.2 - php: - 5.3.3 - 5.4 @@ -17,13 +11,15 @@ matrix: allow_failures: - php: hhvm -before_script: - - php ./tests/prepare-composer.php +install: - composer self-update - - composer install --dev --prefer-source --no-interaction + - composer install --prefer-source --no-interaction --optimize-autoloader + +before_script: - ./vendor/bin/parallel-lint -e php,phpt --exclude vendor . -script: ./vendor/bin/tester -c ./tests/php.ini-unix ./tests/CronnerTests/ +script: + - ./vendor/bin/tester -s -j 32 -c ./tests/php.ini-unix ./tests/CronnerTests after_failure: - 'for i in $(find ./tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done' diff --git a/tests/composer-nette-2.0.json b/tests/composer-nette-2.0.json deleted file mode 100644 index d7cf9e7..0000000 --- a/tests/composer-nette-2.0.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "stekycz/cronner", - "type": "nette-addon", - "description": "Simple tool which helps with maintenance of cron tasks.", - "keywords": ["nette", "cron", "manager", "task"], - "license": "MIT", - "authors": [ - { - "name": "Martin Štekl", - "email": "martin.stekl@gmail.com", - "role": "Developer" - } - ], - "support": { - "email": "martin.stekl@gmail.com", - "issues": "https://github.com/stekycz/Cronner/issues", - "source": "https://github.com/stekycz/Cronner" - }, - "require": { - "php": ">=5.3.3", - "nette/nette": "~2.0.0" - }, - "require-dev": { - "nette/tester": "~1.2", - "janmarek/mockista": "~1.0", - "jakub-onderka/php-parallel-lint": "~0.7" - }, - "suggest": { - "kdyby/events": "Events for Nette Framework", - "kdyby/console": "Symfony Console integration for Kdyby components" - }, - "autoload": { - "classmap": ["Cronner/"] - } -} diff --git a/tests/composer-nette-2.1.json b/tests/composer-nette-2.1.json deleted file mode 100644 index dd985e6..0000000 --- a/tests/composer-nette-2.1.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "stekycz/cronner", - "type": "nette-addon", - "description": "Simple tool which helps with maintenance of cron tasks.", - "keywords": ["nette", "cron", "manager", "task"], - "license": "MIT", - "authors": [ - { - "name": "Martin Štekl", - "email": "martin.stekl@gmail.com", - "role": "Developer" - } - ], - "support": { - "email": "martin.stekl@gmail.com", - "issues": "https://github.com/stekycz/Cronner/issues", - "source": "https://github.com/stekycz/Cronner" - }, - "require": { - "php": ">=5.3.3", - "nette/nette": "~2.1.0" - }, - "require-dev": { - "nette/tester": "~1.2", - "janmarek/mockista": "~1.0", - "jakub-onderka/php-parallel-lint": "~0.7" - }, - "suggest": { - "kdyby/events": "Events for Nette Framework", - "kdyby/console": "Symfony Console integration for Kdyby components" - }, - "autoload": { - "classmap": ["Cronner/"] - } -} diff --git a/tests/composer-nette-2.2.json b/tests/composer-nette-2.2.json deleted file mode 100644 index 092f900..0000000 --- a/tests/composer-nette-2.2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "stekycz/cronner", - "type": "nette-addon", - "description": "Simple tool which helps with maintenance of cron tasks.", - "keywords": ["nette", "cron", "manager", "task"], - "license": "MIT", - "authors": [ - { - "name": "Martin Štekl", - "email": "martin.stekl@gmail.com", - "role": "Developer" - } - ], - "support": { - "email": "martin.stekl@gmail.com", - "issues": "https://github.com/stekycz/Cronner/issues", - "source": "https://github.com/stekycz/Cronner" - }, - "require": { - "php": ">=5.3.3", - "tracy/tracy": "~2.2.0", - "nette/di": "~2.2.0", - "nette/bootstrap": "~2.2.0", - "nette/utils": "~2.2.0", - "nette/reflection": "~2.2.0", - "nette/safe-stream": "~2.2.0" - }, - "require-dev": { - "nette/tester": "~1.2", - "janmarek/mockista": "~1.0", - "jakub-onderka/php-parallel-lint": "~0.7" - }, - "suggest": { - "kdyby/events": "Events for Nette Framework", - "kdyby/console": "Symfony Console integration for Kdyby components" - }, - "autoload": { - "classmap": ["Cronner/"] - } -} diff --git a/tests/prepare-composer.php b/tests/prepare-composer.php deleted file mode 100644 index ddc9590..0000000 --- a/tests/prepare-composer.php +++ /dev/null @@ -1,16 +0,0 @@ - Date: Thu, 5 Mar 2015 21:43:19 +0100 Subject: [PATCH 3/4] Added more environments for tests --- .travis.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6007ef5..3abde67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,26 @@ php: - 5.4 - 5.5 - 5.6 + - 7.0 - hhvm + - hhvm-nightly + +env: + - PHP_BIN=php + - PHP_BIN=php-cgi matrix: allow_failures: + - php: 7.0 + - php: hhvm + - php: hhvm-nightly + + exclude: - php: hhvm + env: PHP_BIN=php-cgi + + - php: hhvm-nightly + env: PHP_BIN=php-cgi install: - composer self-update @@ -19,7 +34,7 @@ before_script: - ./vendor/bin/parallel-lint -e php,phpt --exclude vendor . script: - - ./vendor/bin/tester -s -j 32 -c ./tests/php.ini-unix ./tests/CronnerTests + - ./vendor/bin/tester -s -p $PHP_BIN -j 32 -c ./tests/php.ini-unix ./tests/CronnerTests after_failure: - 'for i in $(find ./tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done' From cd89c2a65ae70b528b1c614f268c8ec8906828ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Thu, 5 Mar 2015 22:09:24 +0100 Subject: [PATCH 4/4] Fixed CronnerExtension tests --- Cronner/DI/CronnerExtension.php | 6 -- tests/CronnerTests/DI/CronnerExtension.phpt | 93 +++++++-------------- 2 files changed, 29 insertions(+), 70 deletions(-) diff --git a/Cronner/DI/CronnerExtension.php b/Cronner/DI/CronnerExtension.php index efab144..e4001ca 100644 --- a/Cronner/DI/CronnerExtension.php +++ b/Cronner/DI/CronnerExtension.php @@ -9,12 +9,6 @@ use Nette\Utils\Json; use Nette\Utils\Validators; -if (!class_exists('Nette\DI\CompilerExtension')) { - class_alias('Nette\Config\CompilerExtension', 'Nette\DI\CompilerExtension'); - class_alias('Nette\Config\Configurator', 'Nette\Configurator'); - class_alias('Nette\Config\Compiler', 'Nette\DI\Compiler'); -} - /** diff --git a/tests/CronnerTests/DI/CronnerExtension.phpt b/tests/CronnerTests/DI/CronnerExtension.phpt index fd406a9..06490c5 100644 --- a/tests/CronnerTests/DI/CronnerExtension.phpt +++ b/tests/CronnerTests/DI/CronnerExtension.phpt @@ -22,14 +22,34 @@ require_once(__DIR__ . "/../bootstrap.php"); class CronnerExtensionTest extends \TestCase { - public function testDefaultConfiguration() + /** + * @var Nette\DI\Compiler + */ + private $compiler; + + + + protected function setUp() { - $compiler = new CompilerMock(); - $compiler->addExtension('cronner', $cronner = new CronnerExtension()); + parent::setUp(); + $builder = new Nette\DI\ContainerBuilder(); + $builder->parameters = array( + 'appDir' => __DIR__ . '/../..', + 'wwwDir' => __DIR__ . '/../..', + 'tempDir' => TEMP_DIR, + 'debugMode' => FALSE, + 'productionMode' => TRUE, + ); + $this->compiler = new Nette\DI\Compiler($builder); + $this->compiler->addExtension('cronner', new CronnerExtension()); + } + - $compiler->config = array(); - $cronner->loadConfiguration(); + public function testDefaultConfiguration() + { + $compiler = $this->compiler; + $compiler->compile(array()); $timestampStorage = $compiler->getContainerBuilder()->getDefinition('cronner.timestampStorage'); $criticalSection = $compiler->getContainerBuilder()->getDefinition('cronner.criticalSection'); @@ -44,18 +64,14 @@ class CronnerExtensionTest extends \TestCase public function testCompleteConfiguration() { - $compiler = new CompilerMock(); - $compiler->addExtension('cronner', $cronner = new CronnerExtension()); - - $compiler->config = array( + $compiler = $this->compiler; + $compiler->compile(array( 'cronner' => array( - 'timestampStorage' => new Nette\DI\Statement('stekycz\Cronner\TimestampStorage\DummyStorage', array(TEMP_DIR . '/cronner')), + 'timestampStorage' => new Nette\DI\Statement('stekycz\Cronner\TimestampStorage\DummyStorage'), 'maxExecutionTime' => 120, 'criticalSectionTempDir' => '%tempDir%/cronner', ) - ); - - $cronner->loadConfiguration(); + )); $timestampStorage = $compiler->getContainerBuilder()->getDefinition('cronner.timestampStorage'); $criticalSection = $compiler->getContainerBuilder()->getDefinition('cronner.criticalSection'); @@ -70,55 +86,4 @@ class CronnerExtensionTest extends \TestCase -class CompilerMock extends Nette\DI\Compiler -{ - - /** - * @var Nette\DI\ContainerBuilder - */ - public $containerBuilder; - - /** - * @var array - */ - public $config = array(); - - - - public function __construct() - { - $this->containerBuilder = new Nette\DI\ContainerBuilder(); - $this->containerBuilder->parameters = array( - 'appDir' => __DIR__ . '/../..', - 'wwwDir' => __DIR__ . '/../..', - 'tempDir' => TEMP_DIR, - 'debugMode' => FALSE, - 'productionMode' => TRUE, - ); - } - - - - /** - * @return array - */ - public function getConfig() - { - return $this->config; - } - - - - /** - * @return Nette\DI\ContainerBuilder - */ - public function getContainerBuilder() - { - return $this->containerBuilder; - } - -} - - - run(new CronnerExtensionTest());