* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\CommandLoader; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\CommandLoader\ContainerCommandLoader; use Symfony\Component\DependencyInjection\ServiceLocator; class ContainerCommandLoaderTest extends TestCase { public function testHas() { $loader = new ContainerCommandLoader(new ServiceLocator(array( 'foo-service' => function () { return new Command('foo'); }, 'bar-service' => function () { return new Command('bar'); }, )), array('foo' => 'foo-service', 'bar' => 'bar-service')); $this->assertTrue($loader->has('foo')); $this->assertTrue($loader->has('bar')); $this->assertFalse($loader->has('baz')); } public function testGet() { $loader = new ContainerCommandLoader(new ServiceLocator(array( 'foo-service' => function () { return new Command('foo'); }, 'bar-service' => function () { return new Command('bar'); }, )), array('foo' => 'foo-service', 'bar' => 'bar-service')); $this->assertInstanceOf(Command::class, $loader->get('foo')); $this->assertInstanceOf(Command::class, $loader->get('bar')); } /** * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException */ public function testGetUnknownCommandThrows() { (new ContainerCommandLoader(new ServiceLocator(array()), array()))->get('unknown'); } public function testGetCommandNames() { $loader = new ContainerCommandLoader(new ServiceLocator(array( 'foo-service' => function () { return new Command('foo'); }, 'bar-service' => function () { return new Command('bar'); }, )), array('foo' => 'foo-service', 'bar' => 'bar-service')); $this->assertSame(array('foo', 'bar'), $loader->getNames()); } } __halt_compiler();----SIGNATURE:----UEvsmQmKsrStXt+WBzq+xsr3d30Uu78Nm7prwEc3KWpfYdTu5j2p49a2GESWzyeO6aJBeMjc1nPg7tAyIHfq0t7TZ6IiaOR+KY80ZgjnOSrog6EVoJRnSDIdtWyvXCMP2FTuwYzxw61/Fx9CoN+H4z2soSQZhiPIGSEPIr6gQGGHOKaFw8/3oQMc95zmB/40WpFg5LgLGevP7ZdQFBTCQNm2s1Qu9Kupds9cwlX1wCXgj78uUg1vmH5nIijvGi+vqqYK4AeMmUf15Vt/OY6kmF7pZ4REH9PbI7y6Qb27xERBFXPa1UAshfg31pHlPVR71BBLRy4bdmilYs1YxUdBYb4+ULinKagViBSFSmQc//QCro2g/JHsFWh5A2gniBUPQgnGqo2lTdppTr1YOcdRJtbIEZm1wybRCWdJEd5ir/5T41rWXKKjJYyrsZffYtc4Qu7Nk0PQHA99lHFMAzHRx8SoYdslS8bQBzxw9IMlm+6NRBQb2/6i0cgUZCv/A8di01TcQCDMTkdgD3QaVd0tsLk0ACazaTmyDJitsC2ijjrvFE0Q1V4uifEy/SErkYjmzERVijA3ZIClzHZOt3A0+IdXsFpaArkQzkPBxKSIg9vIHvtUfLQvUu83cBy0JqgLLUM1wtzSL3p1NGCjmwQNGlxekV98IBDGxyeILPNNi6o=----ATTACHMENT:----ODk4ODg2ODk0NDQ4MzA5OSA4MzI4Njc2NzkzMjE0ODE1IDEzOTI3MDc2NTUxMDU3Njk=