default services conflit ?
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* AJGL Breakpoint Twig Extension Component
|
||||
*
|
||||
* Copyright (C) Antonio J. García Lagar <aj@garcialagar.es>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Ajgl\Twig\Extension\Tests;
|
||||
|
||||
use Ajgl\Twig\Extension\BreakpointExtension;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
/**
|
||||
* @author Antonio J. García Lagar <aj@garcialagar.es>
|
||||
*/
|
||||
class BreakpointExtensionTest extends TestCase
|
||||
{
|
||||
use SetUpTearDownTrait;
|
||||
|
||||
/**
|
||||
* @var BreakpointExtension
|
||||
*/
|
||||
protected $extension;
|
||||
|
||||
protected function doSetUp()
|
||||
{
|
||||
$this->extension = new BreakpointExtension();
|
||||
}
|
||||
|
||||
public function testGetName()
|
||||
{
|
||||
$this->assertSame('breakpoint', $this->extension->getName());
|
||||
}
|
||||
|
||||
public function testGetFunctions()
|
||||
{
|
||||
$functions = $this->extension->getFunctions();
|
||||
$this->assertCount(1, $functions);
|
||||
$function = reset($functions);
|
||||
$this->assertInstanceOf(TwigFunction::class, $function);
|
||||
$callable = $function->getCallable();
|
||||
$this->assertTrue(is_array($callable));
|
||||
$this->assertCount(2, $callable);
|
||||
$this->assertSame($this->extension, $callable[0]);
|
||||
$this->assertSame('setBreakpoint', $callable[1]);
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* AJGL Breakpoint Twig Extension Component
|
||||
*
|
||||
* Copyright (C) Antonio J. García Lagar <aj@garcialagar.es>
|
||||
*
|
||||
* 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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* @author Antonio J. García Lagar <aj@garcialagar.es>
|
||||
*/
|
||||
class AjglBreakpointTwigExtensionExtensionTest extends TestCase
|
||||
{
|
||||
use SetUpTearDownTrait;
|
||||
|
||||
/**
|
||||
* @var ContainerBuilder
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @var AjglBreakpointTwigExtensionExtension
|
||||
*/
|
||||
protected $extension;
|
||||
|
||||
protected function doSetUp()
|
||||
{
|
||||
$this->container = new ContainerBuilder();
|
||||
$this->extension = new AjglBreakpointTwigExtensionExtension();
|
||||
}
|
||||
|
||||
public function testTwigExtensionsDefinition()
|
||||
{
|
||||
$this->extension->load([], $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'));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user