function Y2038TimestampUpdateTest::assertTimestampFields

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

Asserts the size of the timestamp fields.

1 call to Y2038TimestampUpdateTest::assertTimestampFields()
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 147

Class

Y2038TimestampUpdateTest
Tests update of timestamp fields to bigint.

Namespace

Drupal\Tests\system\Functional\Update

Code

public function assertTimestampFields($expected_values) {
    // Check the size of all the fields.
    foreach ($this->tables as $table => $column_names) {
        $table_name = $this->connection
            ->getPrefix() . $table;
        foreach ($column_names as $column_name) {
            $result = $this->connection
                ->query("SELECT data_type FROM information_schema.columns WHERE table_schema = '{$this->databaseName}' and table_name = '{$table_name}' and column_name = '{$column_name}';")
                ->fetchField();
            $this->assertContains($result, $expected_values, "Failed for '{$table_name}' column '{$column_name}'");
        }
    }
}

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