-
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.
- Loading branch information
Showing
14 changed files
with
2,996 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
phpunit.xml | ||
vendor/ | ||
composer.lock | ||
.idea/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,12 @@ | |
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; | ||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
|
||
/** | ||
* RdrenthTwigExtensionExtension | ||
* Class RdrenthTwigExtensionExtension | ||
* | ||
* @author Ronald Drenth <[email protected]> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
|
@@ -18,6 +19,7 @@ class RdrenthTwigExtensionExtension extends Extension | |
{ | ||
/** | ||
* {@inheritdoc} | ||
* @throws \Exception | ||
*/ | ||
public function load(array $config, ContainerBuilder $container) | ||
{ | ||
|
@@ -27,7 +29,7 @@ public function load(array $config, ContainerBuilder $container) | |
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); | ||
$loader->load('services.xml'); | ||
|
||
if (isset($config['stringy'])) { | ||
if (array_key_exists('stringy', $config)) { | ||
$this->registerStringyConfiguration($config['stringy'], $container, $loader); | ||
} | ||
} | ||
|
@@ -44,6 +46,7 @@ public function getAlias() | |
* @param array $config | ||
* @param ContainerBuilder $container | ||
* @param XmlFileLoader $loader | ||
* @throws InvalidArgumentException | ||
*/ | ||
private function registerStringyConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) | ||
{ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
/** | ||
* RdrenthTwigExtensionBundle | ||
* Class RdrenthTwigExtensionBundle | ||
* | ||
* @author Ronald Drenth <[email protected]> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Ronald Drenth <[email protected]> | ||
Copyright (c) 2016 Ronald Drenth <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
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 |
---|---|---|
|
@@ -7,13 +7,13 @@ | |
use Symfony\Component\Yaml\Yaml; | ||
|
||
/** | ||
* ConfigurationTest | ||
* Class ConfigurationTest | ||
* | ||
* @author Ronald Drenth <[email protected]> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/rdrenth/twig-extension-bundle | ||
*/ | ||
class ConfigurationTest extends \PHPUnit_Framework_TestCase | ||
final class ConfigurationTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @return array | ||
|
@@ -40,7 +40,7 @@ public function testDefaultConfigurationProcessing() | |
$rawConfig = Yaml::parse(file_get_contents(__DIR__ . '/../Resources/config/default.yml')); | ||
$config = $this->processConfiguration($rawConfig); | ||
|
||
$this->assertArrayHasKey('stringy', $config); | ||
self::assertArrayHasKey('stringy', $config); | ||
} | ||
|
||
/** | ||
|
@@ -51,13 +51,13 @@ public function testStringyConfigurationProcessing() | |
$rawConfig = Yaml::parse(file_get_contents(__DIR__ . '/../Resources/config/stringy.yml')); | ||
$config = $this->processConfiguration($rawConfig); | ||
|
||
$this->assertArrayHasKey('stringy', $config); | ||
self::assertArrayHasKey('stringy', $config); | ||
$config = $config['stringy']; | ||
|
||
$this->assertArrayHasKey('enabled', $config); | ||
$this->assertArrayHasKey('encoding', $config); | ||
$this->assertArrayHasKey('filters', $config); | ||
$this->assertArrayHasKey('extra_filters', $config); | ||
self::assertArrayHasKey('enabled', $config); | ||
self::assertArrayHasKey('encoding', $config); | ||
self::assertArrayHasKey('filters', $config); | ||
self::assertArrayHasKey('extra_filters', $config); | ||
|
||
$filters = $config['filters']; | ||
foreach ($this->provideStringyFilters() as $filterName => $methodName) { | ||
|
@@ -86,11 +86,11 @@ public function testInvalidStringyMethod() | |
private function assertStringyFilter(array $filters, $indexName, $filterName, $methodName, $enabled = null) | ||
{ | ||
if ($enabled !== null) { | ||
$this->assertEquals($enabled, $filters[$indexName]['enabled']); | ||
self::assertEquals($enabled, $filters[$indexName]['enabled']); | ||
} | ||
|
||
$this->assertEquals($filterName, $filters[$indexName]['filter']); | ||
$this->assertEquals($methodName, $filters[$indexName]['method']); | ||
self::assertEquals($filterName, $filters[$indexName]['filter']); | ||
self::assertEquals($methodName, $filters[$indexName]['method']); | ||
} | ||
|
||
/** | ||
|
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 |
---|---|---|
|
@@ -7,13 +7,13 @@ | |
use Symfony\Component\Yaml\Yaml; | ||
|
||
/** | ||
* ExtenionTest | ||
* Class ExtenionTest | ||
* | ||
* @author Ronald Drenth <[email protected]> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/rdrenth/twig-extension-bundle | ||
*/ | ||
class ExtenionTest extends \PHPUnit_Framework_TestCase | ||
final class ExtenionTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Test DI container with default config | ||
|
@@ -23,9 +23,9 @@ public function testDefaultContainer() | |
$config = Yaml::parse(file_get_contents(__DIR__ . '/../Resources/config/default.yml')); | ||
$container = $this->getContainer($config); | ||
|
||
$this->assertTrue($container->hasDefinition('rdrenth_twig_extension.stringy')); | ||
self::assertTrue($container->hasDefinition('rdrenth_twig_extension.stringy')); | ||
|
||
$this->assertEquals( | ||
self::assertEquals( | ||
$container->getParameterBag()->resolveValue('%rdrenth_twig_extension.stringy.class%'), | ||
$container->getDefinition('rdrenth_twig_extension.stringy')->getClass() | ||
); | ||
|
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
Oops, something went wrong.