function WorkspaceAssociationStringIdsUpdatePathTest::testRunUpdates

Tests the update path for string IDs in workspace_association.

File

core/modules/workspaces/tests/src/Functional/Update/WorkspaceAssociationStringIdsUpdatePathTest.php, line 34

Class

WorkspaceAssociationStringIdsUpdatePathTest
Tests the update path for string IDs in workspace_association.

Namespace

Drupal\Tests\workspaces\Functional\Update

Code

public function testRunUpdates() : void {
    $schema = \Drupal::database()->schema();
    $find_primary_key_columns = new \ReflectionMethod(get_class($schema), 'findPrimaryKeyColumns');
    $this->assertFalse($schema->fieldExists('workspace_association', 'target_entity_id_string'));
    $primary_key_columns = [
        'workspace',
        'target_entity_type_id',
        'target_entity_id',
    ];
    $this->assertEquals($primary_key_columns, $find_primary_key_columns->invoke($schema, 'workspace_association'));
    $this->runUpdates();
    $this->assertTrue($schema->fieldExists('workspace_association', 'target_entity_id_string'));
    $primary_key_columns = [
        'workspace',
        'target_entity_type_id',
        'target_entity_id',
        'target_entity_id_string',
    ];
    $this->assertEquals($primary_key_columns, $find_primary_key_columns->invoke($schema, 'workspace_association'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.