function ConditionTest::testContribCondition
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Database/ConditionTest.php \Drupal\Tests\Core\Database\ConditionTest::testContribCondition()
- 10 core/tests/Drupal/Tests/Core/Database/ConditionTest.php \Drupal\Tests\Core\Database\ConditionTest::testContribCondition()
- 11.x core/tests/Drupal/Tests/Core/Database/ConditionTest.php \Drupal\Tests\Core\Database\ConditionTest::testContribCondition()
Tests that the core Condition can be overridden.
File
-
core/
tests/ Drupal/ Tests/ Core/ Database/ ConditionTest.php, line 186
Class
- ConditionTest
- @coversDefaultClass \Drupal\Core\Database\Query\Condition
Namespace
Drupal\Tests\Core\DatabaseCode
public function testContribCondition() {
$mockCondition = $this->getMockBuilder(Condition::class)
->setMockClassName('MockCondition')
->setConstructorArgs([
NULL,
])
->disableOriginalConstructor()
->getMock();
$contrib_namespace = 'Drupal\\mock\\Driver\\Database\\mock';
$mocked_namespace = $contrib_namespace . '\\Condition';
class_alias('MockCondition', $mocked_namespace);
$options['namespace'] = $contrib_namespace;
$options['prefix'] = '';
$mockPdo = $this->createMock(StubPDO::class);
$connection = new StubConnection($mockPdo, $options);
$condition = $connection->condition('AND');
$this->assertSame('MockCondition', get_class($condition));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.