function SchemaUniquePrefixedKeysIndexTestBase::testAddUniqueKey

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Database/SchemaUniquePrefixedKeysIndexTestBase.php \Drupal\KernelTests\Core\Database\SchemaUniquePrefixedKeysIndexTestBase::testAddUniqueKey()

Tests adding a UNIQUE key to an existing table.

File

core/tests/Drupal/KernelTests/Core/Database/SchemaUniquePrefixedKeysIndexTestBase.php, line 51

Class

SchemaUniquePrefixedKeysIndexTestBase
Tests adding UNIQUE keys to tables.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testAddUniqueKey() : void {
    $this->connection
        ->schema()
        ->addUniqueKey('test_people', 'job', [
        [
            'job',
            10,
        ],
    ]);
    $this->checkUniqueConstraintException('test_people', 'job');
}

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