updated packages
This commit is contained in:
@@ -53,7 +53,7 @@ class AddConsoleCommandPassTest extends TestCase
|
||||
}
|
||||
|
||||
$this->assertTrue($container->hasParameter('console.command.ids'));
|
||||
$this->assertSame(array($public ? $id : $alias), $container->getParameter('console.command.ids'));
|
||||
$this->assertSame([$public ? $id : $alias], $container->getParameter('console.command.ids'));
|
||||
}
|
||||
|
||||
public function testProcessRegistersLazyCommands()
|
||||
@@ -62,8 +62,8 @@ class AddConsoleCommandPassTest extends TestCase
|
||||
$command = $container
|
||||
->register('my-command', MyCommand::class)
|
||||
->setPublic(false)
|
||||
->addTag('console.command', array('command' => 'my:command'))
|
||||
->addTag('console.command', array('command' => 'my:alias'))
|
||||
->addTag('console.command', ['command' => 'my:command'])
|
||||
->addTag('console.command', ['command' => 'my:alias'])
|
||||
;
|
||||
|
||||
(new AddConsoleCommandPass())->process($container);
|
||||
@@ -72,10 +72,10 @@ class AddConsoleCommandPassTest extends TestCase
|
||||
$commandLocator = $container->getDefinition((string) $commandLoader->getArgument(0));
|
||||
|
||||
$this->assertSame(ContainerCommandLoader::class, $commandLoader->getClass());
|
||||
$this->assertSame(array('my:command' => 'my-command', 'my:alias' => 'my-command'), $commandLoader->getArgument(1));
|
||||
$this->assertEquals(array(array('my-command' => new ServiceClosureArgument(new TypedReference('my-command', MyCommand::class)))), $commandLocator->getArguments());
|
||||
$this->assertSame(array(), $container->getParameter('console.command.ids'));
|
||||
$this->assertSame(array(array('setName', array('my:command')), array('setAliases', array(array('my:alias')))), $command->getMethodCalls());
|
||||
$this->assertSame(['my:command' => 'my-command', 'my:alias' => 'my-command'], $commandLoader->getArgument(1));
|
||||
$this->assertEquals([['my-command' => new ServiceClosureArgument(new TypedReference('my-command', MyCommand::class))]], $commandLocator->getArguments());
|
||||
$this->assertSame([], $container->getParameter('console.command.ids'));
|
||||
$this->assertSame([['setName', ['my:command']], ['setAliases', [['my:alias']]]], $command->getMethodCalls());
|
||||
}
|
||||
|
||||
public function testProcessFallsBackToDefaultName()
|
||||
@@ -94,28 +94,28 @@ class AddConsoleCommandPassTest extends TestCase
|
||||
$commandLocator = $container->getDefinition((string) $commandLoader->getArgument(0));
|
||||
|
||||
$this->assertSame(ContainerCommandLoader::class, $commandLoader->getClass());
|
||||
$this->assertSame(array('default' => 'with-default-name'), $commandLoader->getArgument(1));
|
||||
$this->assertEquals(array(array('with-default-name' => new ServiceClosureArgument(new TypedReference('with-default-name', NamedCommand::class)))), $commandLocator->getArguments());
|
||||
$this->assertSame(array(), $container->getParameter('console.command.ids'));
|
||||
$this->assertSame(['default' => 'with-default-name'], $commandLoader->getArgument(1));
|
||||
$this->assertEquals([['with-default-name' => new ServiceClosureArgument(new TypedReference('with-default-name', NamedCommand::class))]], $commandLocator->getArguments());
|
||||
$this->assertSame([], $container->getParameter('console.command.ids'));
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$container
|
||||
->register('with-default-name', NamedCommand::class)
|
||||
->setPublic(false)
|
||||
->addTag('console.command', array('command' => 'new-name'))
|
||||
->addTag('console.command', ['command' => 'new-name'])
|
||||
;
|
||||
|
||||
$pass->process($container);
|
||||
|
||||
$this->assertSame(array('new-name' => 'with-default-name'), $container->getDefinition('console.command_loader')->getArgument(1));
|
||||
$this->assertSame(['new-name' => 'with-default-name'], $container->getDefinition('console.command_loader')->getArgument(1));
|
||||
}
|
||||
|
||||
public function visibilityProvider()
|
||||
{
|
||||
return array(
|
||||
array(true),
|
||||
array(false),
|
||||
);
|
||||
return [
|
||||
[true],
|
||||
[false],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user