function ConditionCastTest::testRawSqlWithExplicitCast

Same name and namespace in other branches
  1. main core/modules/pgsql/tests/src/Kernel/pgsql/ConditionCastTest.php \Drupal\Tests\pgsql\Kernel\pgsql\ConditionCastTest::testRawSqlWithExplicitCast()

Tests that raw SQL with an explicit cast does not trigger a deprecation.

File

core/modules/pgsql/tests/src/Kernel/pgsql/ConditionCastTest.php, line 85

Class

ConditionCastTest
Tests casting of non-text fields for LIKE and regex operators.

Namespace

Drupal\Tests\pgsql\Kernel\pgsql

Code

public function testRawSqlWithExplicitCast() : void {
  $count = $this->connection
    ->query('SELECT COUNT(*) FROM {test} WHERE [age]::text LIKE :pattern', [
    ':pattern' => '2%',
  ])
    ->fetchField();
  $this->assertSame(4, (int) $count);
}

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