@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Support\IsolatedQaDatabase;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DevelopmentEnvironmentTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_the_verified_qa_connection_can_prepare_its_schema(): void
|
||||
{
|
||||
$this->assertTrue(IsolatedQaDatabase::allowsSchemaChanges());
|
||||
$this->artisan('portal:dev-check')->assertSuccessful();
|
||||
}
|
||||
|
||||
public function test_an_active_environment_is_never_treated_as_qa(): void
|
||||
{
|
||||
$this->app->instance('env', 'production');
|
||||
$this->assertFalse(IsolatedQaDatabase::allowsSchemaChanges());
|
||||
}
|
||||
|
||||
public function test_invalid_targets_and_a_mismatched_real_database_are_refused(): void
|
||||
{
|
||||
$original = config('database.connections.pgsql');
|
||||
foreach (['host' => 'remote.example', 'port' => '5432', 'database' => 'investemoz', 'url' => 'pgsql://remote.example/qa_test'] as $key => $value) {
|
||||
config(['database.connections.pgsql' => [...$original, $key => $value]]);
|
||||
$this->assertFalse(IsolatedQaDatabase::allowsSchemaChanges(), $key);
|
||||
}
|
||||
config(['database.connections.pgsql' => [...$original, 'database' => 'different_qa_test']]);
|
||||
$this->assertFalse(IsolatedQaDatabase::allowsSchemaChanges());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user