function UpdateComplexTest::testBetweenConditionUpdate
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php \Drupal\KernelTests\Core\Database\UpdateComplexTest::testBetweenConditionUpdate()
- 10 core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php \Drupal\KernelTests\Core\Database\UpdateComplexTest::testBetweenConditionUpdate()
- 11.x core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php \Drupal\KernelTests\Core\Database\UpdateComplexTest::testBetweenConditionUpdate()
Tests BETWEEN conditional clauses.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ UpdateComplexTest.php, line 62
Class
- UpdateComplexTest
- Tests the Update query builder, complex queries.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testBetweenConditionUpdate() {
$num_updated = $this->connection
->update('test')
->fields([
'job' => 'Musician',
])
->condition('age', [
25,
26,
], 'BETWEEN')
->execute();
$this->assertSame(2, $num_updated, 'Updated 2 records.');
$num_matches = $this->connection
->query('SELECT COUNT(*) FROM {test} WHERE [job] = :job', [
':job' => 'Musician',
])
->fetchField();
$this->assertSame('2', $num_matches, 'Updated fields successfully.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.