instance('env', 'production'); config(['app.url' => 'https://teste-investidor.tempo.co.mz', 'demography.enabled' => true, 'database.default' => 'pgsql', 'database.connections.pgsql.host' => '127.0.0.1', 'database.connections.pgsql.port' => 5432, 'database.connections.pgsql.database' => 'teste_investidor', 'database.connections.pgsql.url' => null]); DB::shouldReceive('selectOne')->twice()->with('SELECT current_database() AS database,inet_server_port() AS port') ->andReturn((object) ['database' => 'teste_investidor', 'port' => 5432], (object) ['database' => 'other_database', 'port' => 5432]); $service = app(DemographicInstallation::class); $this->assertTrue($service->activeTarget()); $this->assertFalse($service->activeTarget()); config(['demography.enabled' => false]); $this->assertFalse($service->activeTarget()); config(['demography.enabled' => true, 'app.url' => 'https://other.example']); $this->assertFalse($service->activeTarget()); config(['app.url' => 'https://teste-investidor.tempo.co.mz', 'database.connections.pgsql.host' => 'remote.example']); $this->assertFalse($service->activeTarget()); } }