Skip to content

Commit

Permalink
feature #100 Add support for Symfony 5 (sstok)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.1-dev branch.

Discussion
----------

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | 
| License       | MIT


Commits
-------

53abf2b Add support for Symfony 5
  • Loading branch information
sstok authored Dec 2, 2019
2 parents 08893c5 + 53abf2b commit 6730210
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 25 deletions.
19 changes: 11 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@ env:
global:
- SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1
- SYMFONY_PHPUNIT_REMOVE="symfony/yaml"
- SYMFONY_PHPUNIT_VERSION=7.5.6
- QA_DOCKER_IMAGE=jakzal/phpqa:1.25.0-php7.2-alpine

matrix:
include:
- php: 7.1
env: SYMFONY_REQUIRE='^3.4'
env:
- SYMFONY_REQUIRE='^3.4'
- SYMFONY_PHPUNIT_VERSION=7.5.6
- php: 7.2
env: SYMFONY_REQUIRE='^4.4'
# - php: 7.3
# env: SYMFONY_REQUIRE='^5.0'
- php: 7.2
env: lint=1
env:
- SYMFONY_REQUIRE='^4.4'
- SYMFONY_PHPUNIT_VERSION=8.3.5
- php: 7.3
env:
- lint=1
- SYMFONY_PHPUNIT_VERSION=8.3.5
- QA_DOCKER_IMAGE=jakzal/phpqa:1.25.0-php7.3-alpine
services:
- docker
fast_finish: true
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
"require": {
"php": "^7.1",
"rollerworks/password-strength-validator": "^1.0.1",
"symfony/framework-bundle": "^3.4.22 || ^4.0"
"symfony/framework-bundle": "^3.4.22 || ^4.0 || ^5.0"
},
"require-dev": {
"matthiasnoback/symfony-dependency-injection-test": "^3.1.0",
"symfony/console": "^3.4.22 || ^4.0",
"symfony/phpunit-bridge": "^3.4.22 || ^4.0",
"symfony/var-dumper": "^3.4.22 || ^4.0"
"matthiasnoback/symfony-dependency-injection-test": "^3.1.0 || ^4.1.0",
"symfony/console": "^3.4.22 || ^4.0 || ^5.0",
"symfony/phpunit-bridge": "^3.4.22 || ^4.0 || ^5.0",
"symfony/var-dumper": "^3.4.22 || ^4.0 || ^5.0"
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "2.1-dev"
}
},
"autoload": {
Expand Down
4 changes: 2 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ includes:
parameters:
autoload_files:
- vendor/autoload.php
- vendor/bin/.phpunit/phpunit-7.5.6-0/vendor/autoload.php # Pain is your friend.... (at least it works for now)
- vendor/bin/.phpunit/phpunit-8.3.5-0/vendor/autoload.php # Pain is your friend.... (at least it works for now)
level: 5
paths:
- ./src
- ./tests

checkNullables: false # To many false positives
ignoreErrors:
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:addDefaultsIfNotSet\(\)#'
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder\:\:root\(\)#'
23 changes: 14 additions & 9 deletions tests/DependencyInjection/ExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,10 @@

class ExtensionTest extends AbstractExtensionTestCase
{
protected function load(array $configurationValues = [])
{
parent::load($configurationValues);

$this->container->getAlias('rollerworks_password_strength.blacklist_provider')->setPublic(true);
$this->container->getCompiler()->addPass(new MakeAllServicesPublicPass(), PassConfig::TYPE_OPTIMIZE);
}

public function testLoadDefaultConfiguration()
{
$this->load();
$this->initProviderService();
$this->compile();

$this->assertContainerBuilderHasService(BlacklistValidator::class);
Expand All @@ -54,6 +47,12 @@ public function testLoadDefaultConfiguration()
$this->assertContainerBuilderHasService($constraint->validatedBy());
}

private function initProviderService(): void
{
$this->container->getAlias('rollerworks_password_strength.blacklist_provider')->setPublic(true);
$this->container->getCompiler()->addPass(new MakeAllServicesPublicPass(), PassConfig::TYPE_OPTIMIZE);
}

public function testLoadWithSqliteConfiguration()
{
$this->load([
Expand All @@ -65,6 +64,7 @@ public function testLoadWithSqliteConfiguration()
],
]);

$this->initProviderService();
$this->compile();

$this->assertContainerBuilderHasService(PasswordStrengthValidator::class);
Expand All @@ -82,6 +82,7 @@ public function testLoadWithArrayConfiguration()
],
]);

$this->initProviderService();
$this->compile();

$this->assertContainerBuilderHasService(PasswordStrengthValidator::class);
Expand Down Expand Up @@ -117,6 +118,7 @@ public function testLoadWithChainConfiguration()
new ArrayProvider(['amy', 'doctor', 'rory'])
);

$this->initProviderService();
$this->compile();

$this->assertContainerBuilderHasService(PasswordStrengthValidator::class);
Expand Down Expand Up @@ -153,6 +155,7 @@ public function testLoadWithLazyChainConfiguration()
new ArrayProvider(['amy', 'doctor', 'rory'])
);

$this->initProviderService();
$this->compile();

$this->assertContainerBuilderHasService(PasswordStrengthValidator::class);
Expand All @@ -174,6 +177,7 @@ public function testPasswordValidatorsAreRegistered()
->setArguments([new Reference('service_container'), []]);

$this->load();
$this->initProviderService();
$this->compile();

/** @var ContainerConstraintValidatorFactory $factory */
Expand Down Expand Up @@ -208,6 +212,7 @@ public function testBlacklistCommandsAreRegistered()
],
],
]);
$this->initProviderService();
$this->compile();

// No need to test all commands.
Expand All @@ -223,7 +228,7 @@ public function testBlacklistCommandsAreRegistered()
self::assertFalse($argument->has('container'), 'Should not have "container" as provider');
}

protected function getContainerExtensions()
protected function getContainerExtensions(): array
{
return [
new RollerworksPasswordStrengthExtension(),
Expand Down

0 comments on commit 6730210

Please sign in to comment.