You are here

private function SchemaTestExtended::AddChangeWithBinarySearchHelper in Drupal driver for SQL Server and SQL Azure 8.2

Performs a count query over the predefined result set and verifies that the number of results matches.

Parameters

mixed[] $results:

string $type: Can either be: "CS_AS" -> Case sensitive / Accent sensitive "CI_AI" -> Case insensitive / Accent insesitive "CI_AS" -> Case insensitive / Accent sensitive

File

tests/src/Kernel/SchemaTestExtended.php, line 322

Class

SchemaTestExtended
Tests table creation and modification via the schema API.

Namespace

Drupal\Tests\sqlsrv\Kernel

Code

private function AddChangeWithBinarySearchHelper(array $results, string $type, string $fieldtype) {
  foreach ($results as $search => $result) {

    // By default, datase collation
    // should be case insensitive returning both rows.
    $count = $this->connection
      ->query('SELECT COUNT(*) FROM {test_table_binary} WHERE name = :name', [
      ':name' => $search,
    ])
      ->fetchField();
    $this
      ->assertEqual($count, $result[$type], "Returned the correct number of total rows for a {$type} search on fieldtype {$fieldtype}");
  }
}