public function testCanBindCommandsToConsole() { $glue = new Glue(new Configuration(['providers' => [ConsoleServiceProvider::class], 'commands' => [TinkerCommand::class]])); $glue->boot(); /** @var Application $console */ $console = $glue->getContainer()->get('console'); $this->assertArrayHasKey('tinker', $console->all()); }
public function testCanBindCommandsToConsole() { $glue = new Glue(new Configuration(['definitions' => [new SymfonyConsoleDefinition([TinkerCommand::class])]])); $glue->boot(); /** @var Application $console */ $console = $glue->getContainer()->get('console'); $this->assertArrayHasKey('tinker', $console->all()); }
public function testCanMirrorPhinxCommands() { $glue = new Glue(new Configuration(['paths' => ['migrations' => 'foobar'], 'providers' => [ConsoleServiceProvider::class, PhinxServiceProvider::class]])); $glue->boot(); $console = $glue->getContainer()->get('console'); /* @var Application $console */ $this->assertArrayHasKey('migrate:migrate', $console->all()); $config = $console->get('migrate:migrate')->getConfig(); $this->assertEquals('foobar', $config['paths']['migrations']); }
public function testCanMirrorPhinxCommands() { $glue = new Glue(new Configuration(['paths' => ['migrations' => 'foobar'], 'definitions' => [new SymfonyConsoleDefinition(), new PhinxDefinition(['paths' => ['migrations' => 'foobar']])]])); $glue->boot(); $console = $glue->getContainer()->get('console'); /* @var Application $console */ $this->assertArrayHasKey('migrate:migrate', $console->all()); /** @var Migrate $command */ $command = $console->get('migrate:migrate'); $config = $command->getConfig(); $this->assertEquals('foobar', $config['paths']['migrations']); }
public function testCanDelegateCallsToRouter() { $router = Mockery::mock('Router'); $router->shouldReceive('get')->once()->andReturnUsing(function ($route) { return $route; }); $container = new Container(); $container->add('router', $router); $glue = new Glue(new Configuration()); $glue->setContainer($container); $glue->get('foobar'); $this->assertEquals(['foobar'], $glue->getContainer()->get('routes')); }
public function testCanUserOtherContainers() { $container = new IlluminateContainer(); $container->singleton('foobar', function () { return 'foobar'; }); $glue = new Glue(new Configuration(), $container); $this->assertEquals('foobar', $glue->getContainer()->get('foobar')); }
public function testCanBindPaths() { $glue = new Glue(new Configuration(['providers' => [], 'paths' => ['foo' => 'bar']])); $glue->boot(); $this->assertEquals('bar', $glue->getContainer()->get('paths.foo')); }
public function testCanBindConfiguration() { $glue = new Glue(new Configuration(['foo' => 'bar'])); $glue->boot(); $this->assertEquals('bar', $glue->getContainer()->get('config.foo')); }