'']] as $config) { config(['database.connections.db2_schema_test' => $config]); try { $connection = DB::connection('db2_schema_test'); $current = trim($connection->selectOne('VALUES CURRENT SCHEMA')->{'1'}); $this->assertNotSame('', $current); $this->assertSame($current, $connection->getConfig('schema')); $schema = $connection->getSchemaBuilder(); $this->assertSame($schema->getTables($current), $schema->getTables()); } finally { DB::purge('db2_schema_test'); } } } /** * Apply an explicitly configured schema to SQL and catalog lookups. */ public function test_explicit_schema_overrides_the_database_default(): void { config(['database.connections.db2_schema_test' => array_replace( config('database.connections.db2_local'), ['schema' => 'SYSCAT'] )]); try { $connection = DB::connection('db2_schema_test'); $this->assertSame('SYSCAT', trim($connection->selectOne('VALUES CURRENT SCHEMA')->{'1'})); $this->assertTrue($connection->getSchemaBuilder()->hasTable('COLUMNS')); } finally { DB::purge('db2_schema_test'); } } }