function Mysql8RequirePrimaryKeyUpdateTest::prepareSettings

Same name in other branches
  1. 9 core/modules/user/tests/src/Functional/Mysql8RequirePrimaryKeyUpdateTest.php \Drupal\Tests\user\Functional\Mysql8RequirePrimaryKeyUpdateTest::prepareSettings()
  2. 11.x core/modules/mysql/tests/src/Functional/Mysql8RequirePrimaryKeyUpdateTest.php \Drupal\Tests\mysql\Functional\Mysql8RequirePrimaryKeyUpdateTest::prepareSettings()

Overrides UpdatePathTestBase::prepareSettings

File

core/modules/mysql/tests/src/Functional/Mysql8RequirePrimaryKeyUpdateTest.php, line 37

Class

Mysql8RequirePrimaryKeyUpdateTest
Tests updates MySQL 8 when sql_require_primary_key is on.

Namespace

Drupal\Tests\mysql\Functional

Code

protected function prepareSettings() {
    parent::prepareSettings();
    // Set sql_require_primary_key for any future connections.
    $settings['databases']['default']['default']['init_commands'] = (object) [
        'value' => [
            'sql_require_primary_key' => 'SET sql_require_primary_key = 1;',
        ],
        'required' => TRUE,
    ];
    $this->writeSettings($settings);
}

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