Skip to content

Commit

Permalink
Merge pull request #39 from WandiParis/fix-sf4.3-deprecation
Browse files Browse the repository at this point in the history
fix: symfony 4.3 deprecation - #32
  • Loading branch information
Nightbr committed Aug 6, 2021
2 parents 6065060 + 7e34448 commit a26617b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ php:
- '7.1'

before_script:
- composer install --dev -v --prefer-source
- php -d memory_limit=-1 composer install --dev -v --prefer-source

script:
- bin/phpspec run -fpretty --verbose
Expand Down
25 changes: 25 additions & 0 deletions spec/DependencyInjection/ConfigurationSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace spec\Welp\MailchimpBundle\DependencyInjection;

use PhpSpec\ObjectBehavior;

class ConfigurationSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('Welp\MailchimpBundle\DependencyInjection\Configuration');
}

function it_is_symfony_configuration()
{
$this->shouldImplement('Symfony\Component\Config\Definition\ConfigurationInterface');
}

function it_gets_config_tree_builder()
{
$this
->getConfigTreeBuilder()
->shouldHaveType('Symfony\Component\Config\Definition\Builder\TreeBuilder');
}
}
9 changes: 7 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('welp_mailchimp');
$treeBuilder = new TreeBuilder('welp_mailchimp');

if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
$rootNode = $treeBuilder->root('welp_mailchimp');
}

$rootNode
->children()
Expand Down

0 comments on commit a26617b

Please sign in to comment.