CodeExplorer getExpectationsBefore example
$this->
importFixtureSchema();
$schemaManager =
$connection->
createSchemaManager();
$tableName = '_dpkc_main';
$playbookGenerator =
new MakeVersionableMigrationHelper($connection);
$hydratedData =
$playbookGenerator->
getRelationData($tableName, 'id'
);
$playbook =
$playbookGenerator->
createSql($hydratedData,
$tableName, 'mission_id', Uuid::
randomHex());
foreach ($this->
getExpectationsBefore() as $tableName =>
$expectation) { $indexes =
$schemaManager->
listTableIndexes($tableName);
$foreignKeys =
$schemaManager->
listTableForeignKeys($tableName);
$columns =
$schemaManager->
listTableColumns($tableName);
static::
assertCount($expectation['indexes'
],
$indexes,
print_r($indexes, true
) . ' index on ' .
$tableName);
static::
assertCount($expectation['foreignKeys'
],
$foreignKeys,
print_r($foreignKeys, true
) . ' foreignKey on ' .
$tableName);
static::
assertCount($expectation['columns'
],
$columns,
print_r($columns, true
) . ' columns on ' .
$tableName);
} foreach ($playbook as $query) { $connection->
executeStatement($query);
}