mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-04 22:13:54 +09:00
Dependency updates and update version number
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Translation\Tests\DependencyInjection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\Translation\DependencyInjection\TranslationDumperPass;
|
||||
|
||||
@@ -19,48 +20,29 @@ class TranslationDumperPassTest extends TestCase
|
||||
{
|
||||
public function testProcess()
|
||||
{
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->disableOriginalConstructor()->getMock();
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->disableOriginalConstructor()->getMock();
|
||||
|
||||
$container->expects($this->once())
|
||||
->method('hasDefinition')
|
||||
->with('translation.writer')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$container->expects($this->once())
|
||||
->method('getDefinition')
|
||||
->with('translation.writer')
|
||||
->will($this->returnValue($definition));
|
||||
|
||||
$valueTaggedServiceIdsFound = array(
|
||||
'foo.id' => array(
|
||||
array('alias' => 'bar.alias'),
|
||||
),
|
||||
);
|
||||
$container->expects($this->once())
|
||||
->method('findTaggedServiceIds')
|
||||
->with('translation.dumper', true)
|
||||
->will($this->returnValue($valueTaggedServiceIdsFound));
|
||||
|
||||
$definition->expects($this->once())->method('addMethodCall')->with('addDumper', array('bar.alias', new Reference('foo.id')));
|
||||
$container = new ContainerBuilder();
|
||||
$writerDefinition = $container->register('translation.writer');
|
||||
$container->register('foo.id')
|
||||
->addTag('translation.dumper', array('alias' => 'bar.alias'));
|
||||
|
||||
$translationDumperPass = new TranslationDumperPass();
|
||||
$translationDumperPass->process($container);
|
||||
|
||||
$this->assertEquals(array(array('addDumper', array('bar.alias', new Reference('foo.id')))), $writerDefinition->getMethodCalls());
|
||||
}
|
||||
|
||||
public function testProcessNoDefinitionFound()
|
||||
{
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->disableOriginalConstructor()->getMock();
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$container->expects($this->once())
|
||||
->method('hasDefinition')
|
||||
->with('translation.writer')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$container->expects($this->never())->method('getDefinition');
|
||||
$container->expects($this->never())->method('findTaggedServiceIds');
|
||||
$definitionsBefore = count($container->getDefinitions());
|
||||
$aliasesBefore = count($container->getAliases());
|
||||
|
||||
$translationDumperPass = new TranslationDumperPass();
|
||||
$translationDumperPass->process($container);
|
||||
|
||||
// the container is untouched (i.e. no new definitions or aliases)
|
||||
$this->assertCount($definitionsBefore, $container->getDefinitions());
|
||||
$this->assertCount($aliasesBefore, $container->getAliases());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user