Skip to content

Commit

Permalink
bug #288 add back Travis job for lowest allowed deps (xabbuh)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the master branch (closes #288).

Discussion
----------

add back Travis job for lowest allowed deps

Commits
-------

61561b7 add back Travis job for lowest allowed deps
  • Loading branch information
javiereguiluz committed May 15, 2015
2 parents 21c6aa7 + 61561b7 commit b38a0cc
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build
composer.lock
phpunit.xml
vendor/*
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ matrix:
fast_finish: true
include:
- php: 5.3
- php: 5.3
env: deps="low"
- php: 5.4
- php: 5.5
- php: 5.6
Expand Down
43 changes: 21 additions & 22 deletions Tests/DependencyInjection/EasyAdminExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use InvalidArgumentException;
use RuntimeException;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Yaml\Yaml;
use JavierEguiluz\Bundle\EasyAdminBundle\DependencyInjection\EasyAdminExtension;
use JavierEguiluz\Bundle\EasyAdminBundle\Tests\CommonPhpUnitTestCase;
Expand Down Expand Up @@ -41,22 +42,20 @@ public function setUp()
*/
public function testBackendConfigurations($inputFixtureFilepath, $outputFixtureFilepath)
{
if ('2.3.x' === getenv('SYMFONY_VERSION') && !$this->isTestCompatibleWithYamlComponent($inputFixtureFilepath)) {
$this->markTestSkipped('This test fails because of the behavior of the YAML component in Symfony 2.3.x version.');
if ('2' === Kernel::MAJOR_VERSION && '3' === Kernel::MINOR_VERSION && !$this->isTestCompatibleWithYamlComponent($inputFixtureFilepath)) {
$this->markTestSkipped('The YAML component does not ignore duplicate keys in Symfony 2.3.');
}

$parsedConfiguration = $this->parseConfigurationFile($inputFixtureFilepath);
$expectedConfiguration = file_get_contents($outputFixtureFilepath);
$expectedConfiguration = str_replace("\r", '', $expectedConfiguration); // Prevents bugs from different git crlf config
$this->parseConfigurationFile($inputFixtureFilepath);

$this->assertEquals($expectedConfiguration, $parsedConfiguration, sprintf('%s configuration is correctly parsed into %s', $inputFixtureFilepath, $outputFixtureFilepath));
$this->assertConfigurationParameterMatchesExpectedValue($outputFixtureFilepath);
}

/**
* @expectedException RuntimeException
* @expectedExceptionMessage The "TestEntity" entity must define its associated Doctrine entity class using the "class" option.
*/
public function testClassOptionIsMandatoryFoEntityConfiguration()
public function testClassOptionIsMandatoryForEntityConfiguration()
{
$this->parseConfigurationFile(__DIR__.'/fixtures/exceptions/class_option_is_mandatory_for_expanded_entity_configuration.yml');
}
Expand Down Expand Up @@ -160,12 +159,13 @@ public function testColorSchemeValuesAreLimited()
$this->parseConfigurationFile(__DIR__.'/fixtures/exceptions/color_scheme_values_are_limited.yml');
}

/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
* @expectedExceptionMessage Unrecognized option "this_template_name_is_not_valid" under "easy_admin.design.templates"
*/
public function testOverriddenTemplateNamesAreLimited()
{
$this->setExpectedExceptionRegExp(
'\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException',
'/Unrecognized options? "this_template_name_is_not_valid" under "easy_admin.design.templates"/'
);

$this->parseConfigurationFile(__DIR__.'/fixtures/exceptions/overridden_template_names_are_limited.yml');
}

Expand All @@ -179,11 +179,9 @@ public function testEntityOverridesDefaultTemplates()
$fixturesDir = __DIR__.'/fixtures/templates/overridden_by_entity';

foreach (range(1, 5) as $i) {
$parsedConfiguration = $this->parseConfigurationFile($fixturesDir.'/input/admin_00'.$i.'.yml', $fixturesDir);
$expectedConfiguration = file_get_contents($fixturesDir.'/output/config_00'.$i.'.yml');
$expectedConfiguration = str_replace("\r", '', $expectedConfiguration); // Prevents bugs from different git crlf config
$this->parseConfigurationFile($fixturesDir.'/input/admin_00'.$i.'.yml', $fixturesDir);

$this->assertEquals($expectedConfiguration, $parsedConfiguration);
$this->assertConfigurationParameterMatchesExpectedValue($fixturesDir.'/output/config_00'.$i.'.yml');
}
}

Expand All @@ -197,11 +195,9 @@ public function testApplicationOverridesDefaultTemplates()
$fixturesDir = __DIR__.'/fixtures/templates/overridden_by_application';

foreach (range(1, 5) as $i) {
$parsedConfiguration = $this->parseConfigurationFile($fixturesDir.'/input/admin_00'.$i.'.yml', $fixturesDir);
$expectedConfiguration = file_get_contents($fixturesDir.'/output/config_00'.$i.'.yml');
$expectedConfiguration = str_replace("\r", '', $expectedConfiguration); // Prevents bugs from different git crlf config
$this->parseConfigurationFile($fixturesDir.'/input/admin_00'.$i.'.yml', $fixturesDir);

$this->assertEquals($expectedConfiguration, $parsedConfiguration);
$this->assertConfigurationParameterMatchesExpectedValue($fixturesDir.'/output/config_00'.$i.'.yml');
}
}

Expand All @@ -225,11 +221,14 @@ private function parseConfigurationFile($filepath, $kernelRootDir = null)

$inputConfiguration = Yaml::parse(file_get_contents($filepath));
$this->loader->load($inputConfiguration, $this->container);
}

$easyAdminConfigParameter = $this->container->getParameter('easyadmin.config');
$parsedConfiguration = Yaml::dump(array('easy_admin' => $easyAdminConfigParameter), INF);
private function assertConfigurationParameterMatchesExpectedValue($expectedConfigFile)
{
$expectedConfiguration = Yaml::parse(file_get_contents($expectedConfigFile));
$actualConfiguration = $this->container->getParameter('easyadmin.config');

return $parsedConfiguration;
$this->assertEquals($expectedConfiguration['easy_admin'], $actualConfiguration);
}

private function isTestCompatibleWithYamlComponent($filepath)
Expand Down
2 changes: 1 addition & 1 deletion Tests/Fixtures/App/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:

framework:
secret: secret
translator: { fallbacks: ["%locale%"] }
translator: ~
default_locale: "%locale%"
test: ~
router: { resource: "%kernel.root_dir%/config/routing_base.yml" }
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
],
"require": {
"php" : ">=5.3.0",
"pagerfanta/pagerfanta" : "~1.0",
"pagerfanta/pagerfanta" : "~1.0,>=1.0.1",
"symfony/symfony" : "~2.3",
"doctrine/orm" : "~2.3",
"doctrine/doctrine-bundle" : "~1.2",
"twig/extensions" : "~1.0",
"sensio/distribution-bundle" : "~2.3|~3.0",
"sensio/framework-extra-bundle" : "~3.0,>=3.0.2",
"twig/twig" : "~1.0"
"twig/twig" : "~1.12"
},
"require-dev": {
"phpunit/phpunit" : "~4.4",
Expand Down

0 comments on commit b38a0cc

Please sign in to comment.