Skip to content

Commit

Permalink
Merge pull request #39 from stekycz/feature/testing
Browse files Browse the repository at this point in the history
Updated continuous testing
  • Loading branch information
stekycz committed Mar 5, 2015
2 parents e964608 + cd89c2a commit 2608443
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 208 deletions.
31 changes: 21 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
language: php

env:
- NETTE=default
- NETTE=nette-2.0
- NETTE=nette-2.1
- NETTE=nette-2.2

php:
- 5.3.3
- 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

before_script:
- php ./tests/prepare-composer.php
exclude:
- php: hhvm
env: PHP_BIN=php-cgi

- php: hhvm-nightly
env: PHP_BIN=php-cgi

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 -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'
6 changes: 0 additions & 6 deletions Cronner/DI/CronnerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}



/**
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
93 changes: 29 additions & 64 deletions tests/CronnerTests/DI/CronnerExtension.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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());
35 changes: 0 additions & 35 deletions tests/composer-nette-2.0.json

This file was deleted.

35 changes: 0 additions & 35 deletions tests/composer-nette-2.1.json

This file was deleted.

40 changes: 0 additions & 40 deletions tests/composer-nette-2.2.json

This file was deleted.

16 changes: 0 additions & 16 deletions tests/prepare-composer.php

This file was deleted.

0 comments on commit 2608443

Please sign in to comment.