public function testDoesntBootTwice() { $provider = Mockery::mock(DefinitionProviderInterface::class); $provider->shouldReceive('getDefinitions')->once()->andReturn([new ParameterDefinition('foobar', 'foobar')]); $glue = new Glue(new Configuration(['definitions' => [$provider]])); $glue->boot(); $glue->boot(); }
public function testDoesntBootTwice() { $provider = Mockery::mock(ServiceProviderInterface::class); $provider->shouldReceive('setContainer')->once(); $provider->shouldReceive('provides')->once()->andReturn(['foobar']); $glue = new Glue(new Configuration(['providers' => [$provider]])); $glue->boot(); $glue->boot(); }
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 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')); }