runDbTasks example

// Set the update URL. This must be set here rather than in     // self::__construct() or the old URL generator will leak additional test     // sites. Additionally, we need to prevent the path alias processor from     // running because we might not have a working alias system before running     // the updates.     $this->updateUrl = Url::fromRoute('system.db_update', []['path_processing' => FALSE]);

    $this->setupBaseUrl();

    // Install Drupal test site.     $this->prepareEnvironment();
    $this->runDbTasks();

    // We are going to set a missing zlib requirement property for usage     // during the performUpgrade() and tearDown() methods. Also set that the     // tests failed.     if (!$this->zlibInstalled) {
      parent::setUp();
      return;
    }
    $this->installDrupal();

    // Add the config directories to settings.php.

class Mysql8RequirePrimaryKeyUpdateTest extends UpdatePathTestBase {

  /** * {@inheritdoc} */
  protected function runDbTasks() {
    parent::runDbTasks();
    $database = Database::getConnection();
    $is_maria = method_exists($database, 'isMariaDb') && $database->isMariaDb();
    if ($database->databaseType() !== 'mysql' || $is_maria || version_compare($database->version(), '8.0.13', '<')) {
      $this->markTestSkipped('This test only runs on MySQL 8.0.13 and above');
    }

    $database->query("SET sql_require_primary_key = 1;")->execute();
  }

  /** * {@inheritdoc} */
Home | Imprint | This part of the site doesn't use cookies.