forked from twigphp/Twig
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Extra Bundle config from XML to PHP
- Loading branch information
Showing
18 changed files
with
206 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
extra/twig-extra-bundle/src/Resources/config/cssinliner.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Twig\Extra\CssInliner\CssInlinerExtension; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
->set('twig.extension.cssinliner', CssInlinerExtension::class) | ||
->tag('twig.extension') | ||
; | ||
}; |
14 changes: 0 additions & 14 deletions
14
extra/twig-extra-bundle/src/Resources/config/cssinliner.xml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Twig\Extra\Html\HtmlExtension; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
->set('twig.extension.html', HtmlExtension::class) | ||
->tag('twig.extension') | ||
; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Twig\Extra\Inky\InkyExtension; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
->set('twig.extension.inky', InkyExtension::class) | ||
->tag('twig.extension') | ||
; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Twig\Extra\Intl\IntlExtension; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
->set('twig.extension.intl', IntlExtension::class) | ||
->tag('twig.extension') | ||
; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Twig\Extra\Markdown\DefaultMarkdown; | ||
use Twig\Extra\Markdown\MarkdownExtension; | ||
use Twig\Extra\Markdown\MarkdownRuntime; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
->set('twig.extension.markdown', MarkdownExtension::class) | ||
->tag('twig.extension') | ||
|
||
->set('twig.runtime.markdown', MarkdownRuntime::class) | ||
->args([ | ||
service('twig.markdown.default'), | ||
]) | ||
->tag('twig.runtime') | ||
|
||
->set('twig.markdown.default', DefaultMarkdown::class) | ||
; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Twig\Extra\String\StringExtension; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
->set('twig.extension.string', StringExtension::class) | ||
->tag('twig.extension') | ||
; | ||
}; |
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
extra/twig-extra-bundle/src/Resources/config/suggestor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Twig\Extra\TwigExtraBundle\MissingExtensionSuggestor; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
->set('twig.missing_extension_suggestor', MissingExtensionSuggestor::class) | ||
; | ||
}; |
12 changes: 0 additions & 12 deletions
12
extra/twig-extra-bundle/src/Resources/config/suggestor.xml
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
extra/twig-extra-bundle/src/Tests/DependencyInjection/TwigExtraExtensionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Twig\Extra\TwigExtraBundle\Tests\DependencyInjection; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; | ||
use Twig\Extra\TwigExtraBundle\DependencyInjection\TwigExtraExtension; | ||
use Twig\Extra\TwigExtraBundle\Extensions; | ||
|
||
class TwigExtraExtensionTest extends TestCase | ||
{ | ||
public function testDefaultConfiguration() | ||
{ | ||
$container = new ContainerBuilder(new ParameterBag([ | ||
'kernel.debug' => false, | ||
])); | ||
$container->registerExtension(new TwigExtraExtension()); | ||
$container->loadFromExtension('twig_extra'); | ||
$container->getCompilerPassConfig()->setOptimizationPasses([]); | ||
$container->getCompilerPassConfig()->setRemovingPasses([]); | ||
$container->getCompilerPassConfig()->setAfterRemovingPasses([]); | ||
$container->compile(); | ||
|
||
foreach (Extensions::getClasses() as $name => $class) { | ||
$this->assertEquals($class, $container->getDefinition('twig.extension.'.$name)->getClass()); | ||
} | ||
} | ||
} |