class SelectLeastTest in Drupal 10
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/SelectLeastTest.php \Drupal\KernelTests\Core\Database\SelectLeastTest
Tests the SQL LEAST operator.
@group Database
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\KernelTests\Core\Database\DatabaseTestBase
- class \Drupal\KernelTests\Core\Database\SelectLeastTest
- class \Drupal\KernelTests\Core\Database\DatabaseTestBase
Expanded class hierarchy of SelectLeastTest
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ SelectLeastTest.php, line 10
Namespace
Drupal\KernelTests\Core\DatabaseView source
class SelectLeastTest extends DatabaseTestBase {
/**
* Tests the SQL LEAST operator.
*
* @dataProvider selectLeastProvider
*/
public function testSelectLeast($values, $expected) {
$least = $this->connection
->query("SELECT LEAST(:values[])", [
':values[]' => $values,
])
->fetchField();
$this
->assertEquals($expected, $least);
}
public function selectLeastProvider() {
return [
[
[
1,
2,
3,
4,
5,
6,
],
1,
],
[
[
'A',
'B',
'C',
'NULL',
'F',
],
'A',
],
[
[
'NULL',
'NULL',
],
'NULL',
],
[
[
'TRUE',
'FALSE',
],
'FALSE',
],
[
[
'A',
'B',
'C',
'NULL',
],
'A',
],
];
}
}