35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?php
|
||
|
||
namespace Tests\Feature\Console;
|
||
|
||
use Illuminate\Database\Schema\Blueprint;
|
||
use Illuminate\Support\Facades\DB;
|
||
use Illuminate\Support\Facades\Schema;
|
||
use Tests\TestCase;
|
||
|
||
class BusinessDataPlanTest extends TestCase
|
||
{
|
||
public function test_every_code_owned_dataset_requires_an_explicit_policy(): void
|
||
{
|
||
config([
|
||
'database.connections.business_mirror' => ['driver' => 'sqlite', 'database' => ':memory:', 'prefix' => ''],
|
||
'upstream_mirrors.connection' => 'business_mirror',
|
||
'upstream_mirrors.datasets' => [
|
||
'source.schema.fact' => ['source_key' => 'source', 'schema' => 'schema', 'object' => 'fact', 'target' => 'fact_rows', 'keys' => ['id']],
|
||
],
|
||
'business_data.datasets' => [],
|
||
]);
|
||
DB::purge('business_mirror');
|
||
Schema::connection('business_mirror')->create('business_data_placements', function (Blueprint $table): void {
|
||
$table->string('dataset_key')->primary();
|
||
$table->string('phase');
|
||
});
|
||
|
||
$this->artisan('business-data:plan')
|
||
->expectsOutputToContain('缺少存储策略:source.schema.fact')
|
||
->assertFailed();
|
||
|
||
DB::purge('business_mirror');
|
||
}
|
||
}
|