-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ajgarlag/symfony-bundle
Add Symfony Bundle
- Loading branch information
Showing
7 changed files
with
139 additions
and
1 deletion.
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
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 | ||
|
||
/* | ||
* AJGL Breakpoint Twig Extension Component | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Twig\Extension\SymfonyBundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
/** | ||
* @author Antonio J. García Lagar <[email protected]> | ||
*/ | ||
class AjglBreakpointTwigExtensionBundle extends Bundle | ||
{ | ||
} |
29 changes: 29 additions & 0 deletions
29
src/SymfonyBundle/DependencyInjection/AjglBreakpointTwigExtensionExtension.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,29 @@ | ||
<?php | ||
|
||
/* | ||
* AJGL Breakpoint Twig Extension Component | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Twig\Extension\SymfonyBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Loader; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
|
||
/** | ||
* @author Antonio J. García Lagar <[email protected]> | ||
*/ | ||
class AjglBreakpointTwigExtensionExtension extends Extension | ||
{ | ||
public function load(array $config, ContainerBuilder $container) | ||
{ | ||
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | ||
$loader->load('twig.xml'); | ||
} | ||
} |
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,13 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
|
||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
|
||
<services> | ||
<service id="ajgl_twig_extension.breakpoint" class="Ajgl\Twig\Extension\BreakpointExtension" public="false"> | ||
<tag name="twig.extension"/> | ||
</service> | ||
</services> | ||
|
||
</container> |
49 changes: 49 additions & 0 deletions
49
tests/SymfonyBundle/DependencyInjection/AjglBreakpointTwigExtensionExtensionTest.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,49 @@ | ||
<?php | ||
|
||
/* | ||
* AJGL Breakpoint Twig Extension Component | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Twig\Extension\Tests\SymfonyBundle\DependencyInjection; | ||
|
||
use Ajgl\Twig\Extension\SymfonyBundle\DependencyInjection\AjglBreakpointTwigExtensionExtension; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
/** | ||
* @author Antonio J. García Lagar <[email protected]> | ||
*/ | ||
class AjglBreakpointTwigExtensionExtensionTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var ContainerBuilder | ||
*/ | ||
protected $container; | ||
|
||
/** | ||
* @var AjglBreakpointTwigExtensionExtension | ||
*/ | ||
protected $extension; | ||
|
||
protected function setUp() | ||
{ | ||
$this->container = new ContainerBuilder(); | ||
$this->extension = new AjglBreakpointTwigExtensionExtension(); | ||
} | ||
|
||
public function testTwigExtensionsDefinition() | ||
{ | ||
$this->extension->load(array(), $this->container); | ||
$this->assertTrue($this->container->hasDefinition('ajgl_twig_extension.breakpoint')); | ||
$definition = $this->container->getDefinition('ajgl_twig_extension.breakpoint'); | ||
$this->assertSame( | ||
'Ajgl\Twig\Extension\BreakpointExtension', | ||
$definition->getClass() | ||
); | ||
$this->assertNotNull($definition->getTag('twig.extension')); | ||
} | ||
} |