Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove TreeBuilder deprecation #106

Merged
merged 3 commits into from Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions DependencyInjection/Configuration.php
Expand Up @@ -20,8 +20,12 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$treeBuilder->root('translation_tools');
if (method_exists(TreeBuilder::class, 'getRootNode')) {
$treeBuilder = new TreeBuilder('translation_tools');
} else {
$treeBuilder = new TreeBuilder();
$treeBuilder->root('translation_tools');
}

return $treeBuilder;
}
Expand Down
23 changes: 23 additions & 0 deletions Tests/DependencyInjection/ConfigurationTest.php
@@ -0,0 +1,23 @@
<?php
/**
* This file is authored by PrestaShop SA and Contributors <contact@prestashop.com>
*
* It is distributed under MIT license.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace PrestaShop\TranslationToolsBundle\Tests\DependencyInjection;
atomiix marked this conversation as resolved.
Show resolved Hide resolved

use PrestaShop\TranslationToolsBundle\DependencyInjection\Configuration;
use PrestaShop\TranslationToolsBundle\Tests\PhpUnit\TestCase;

class ConfigurationTest extends TestCase
{
public function testNewConfiguration()
atomiix marked this conversation as resolved.
Show resolved Hide resolved
{
$configuration = new Configuration();
$this->assertSame('translation_tools', $configuration->getConfigTreeBuilder()->buildTree()->getName());
}
}