Skip to content

Commit

Permalink
Merge pull request #11 from gianiaz/root-node-fix
Browse files Browse the repository at this point in the history
Root node fix
  • Loading branch information
mark-gerarts authored Oct 16, 2019
2 parents 5babeb8 + db6b837 commit 128d934
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 4 deletions.
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
language: php
php:
- 7.1
- 7.2
- 7.3
- 7.4snapshot
cache:
directories:
- $HOME/.composer/cache/files

before_install:
- composer self-update

install:
- composer update --no-interaction --prefer-dist --prefer-stable

script:
- ./vendor/bin/phpunit tests/*

jobs:
include:
- stage: Test
php: 7.1
name: prefer-lowest
install:
- composer update --no-interaction --prefer-dist --prefer-stable --prefer-lowest
8 changes: 6 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

namespace AutoMapperPlus\AutoMapperPlusBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('auto_mapper_plus');
$treeBuilder = new TreeBuilder('auto_mapper_plus');
/** @var ArrayNodeDefinition $rootNode */
$rootNode = \method_exists(TreeBuilder::class, 'getRootNode')
? $treeBuilder->getRootNode()
: $treeBuilder->root('auto_mapper_plus');

$rootNode
->children()
Expand Down
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
}
},
"require": {
"php": ">=7.0.0",
"php": ">=7.1.0",
"symfony/framework-bundle": "^3.3|^4.0",
"mark-gerarts/auto-mapper-plus": "^1.0"
"mark-gerarts/auto-mapper-plus": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "^6.5|^8.0",
"symfony/phpunit-bridge": "^3.4|^4.0"
}
}
22 changes: 22 additions & 0 deletions tests/TestConfiguration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);

namespace AutoMapperPlus\AutoMapperPlusBundle\test;


use AutoMapperPlus\AutoMapperPlusBundle\DependencyInjection\Configuration;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;

class TestConfiguration extends TestCase
{

public function testGetConfiguration() {

$configuration = new Configuration();

$this->assertInstanceOf(TreeBuilder::class, $configuration->getConfigTreeBuilder());

}

}

0 comments on commit 128d934

Please sign in to comment.