function Y2038TimestampUpdateTest::collectTimestampFieldsFromDatabase

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/src/Functional/Update/Y2038TimestampUpdateTest.php \Drupal\Tests\system\Functional\Update\Y2038TimestampUpdateTest::collectTimestampFieldsFromDatabase()

Collect the timestamp fields from the database and update table list.

1 call to Y2038TimestampUpdateTest::collectTimestampFieldsFromDatabase()
Y2038TimestampUpdateTest::testUpdate in core/modules/system/tests/src/Functional/Update/Y2038TimestampUpdateTest.php
Tests update of time fields.

File

core/modules/system/tests/src/Functional/Update/Y2038TimestampUpdateTest.php, line 125

Class

Y2038TimestampUpdateTest
Tests update of timestamp fields to bigint.

Namespace

Drupal\Tests\system\Functional\Update

Code

public function collectTimestampFieldsFromDatabase() {
  /** @var \Drupal\Core\Database\Connection $connection */
  $connection = \Drupal::service('database');
  // Build list of all tables and fields to check.
  $tables = $connection->schema()
    ->findTables('migrate_map_%');
  foreach ($tables as $table) {
    $this->tables[$table] = [
      'last_imported',
    ];
  }
  $tables = $connection->schema()
    ->findTables('cache_%');
  $tables = array_filter($tables, function ($table) {
    return str_starts_with($table, 'cache_') && $table !== 'cache_bogus';
  });
  $this->assertNotEmpty($tables);
  foreach ($tables as $table) {
    $this->tables[$table] = [
      'expire',
    ];
  }
}

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