function NonPublicSchemaTest::testUpdate

Same name in other branches
  1. 11.x core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php \Drupal\Tests\pgsql\Kernel\pgsql\NonPublicSchemaTest::testUpdate()

@covers \Drupal\Core\Database\Connection::update

File

core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php, line 169

Class

NonPublicSchemaTest
Tests schema API for non-public schema for the PostgreSQL driver.

Namespace

Drupal\Tests\pgsql\Kernel\pgsql

Code

public function testUpdate() : void {
    $updated_record = $this->testingFakeConnection
        ->update('faking_table')
        ->fields([
        'test_field' => 321,
    ])
        ->condition('id', 1)
        ->execute();
    $this->assertSame(1, $updated_record, 'Updated 1 record.');
    $updated_results = $this->testingFakeConnection
        ->select('faking_table')
        ->fields('faking_table')
        ->condition('id', '1')
        ->execute()
        ->fetchAll();
    $this->assertSame('321', $updated_results[0]->test_field);
}

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