public function test_can_make_configuration() { $this->connection->shouldReceive('getConfiguration')->andReturn($this->configuration); $this->config->shouldReceive('get')->once()->with('migrations.name', 'Doctrine Migrations')->andReturn('Doctrine Migrations'); $this->config->shouldReceive('get')->once()->with('migrations.namespace', 'Database\\Migrations')->andReturn('Database\\Migrations'); $this->config->shouldReceive('get')->once()->with('migrations.table', 'migrations')->andReturn('migrations'); $this->config->shouldReceive('get')->once()->with('migrations.schema.filter', '/^(?).*$/')->andReturn('migrations'); $this->configuration->shouldReceive('setFilterSchemaAssetsExpression')->with('/^(?).*$/')->once(); $this->config->shouldReceive('get')->once()->with('migrations.naming_strategy', DefaultNamingStrategy::class)->andReturn(DefaultNamingStrategy::class); $this->container->shouldReceive('make')->with(DefaultNamingStrategy::class)->once()->andReturn(new DefaultNamingStrategy()); $this->config->shouldReceive('get')->once()->with('migrations.directory', database_path('migrations'))->andReturn(database_path('migrations')); $configuration = $this->factory->make($this->connection); $this->assertInstanceOf(Configuration::class, $configuration); $this->assertEquals('Doctrine Migrations', $configuration->getName()); $this->assertEquals('Database\\Migrations', $configuration->getMigrationsNamespace()); $this->assertEquals('migrations', $configuration->getMigrationsTableName()); $this->assertInstanceOf(DefaultNamingStrategy::class, $configuration->getNamingStrategy()); $this->assertEquals(database_path('migrations'), $configuration->getMigrationsDirectory()); }
/** * @param string|null $name * * @return Configuration */ public function getForConnection($name = null) { $connection = $this->registry->getConnection($name); return $this->factory->make($connection); }