class QueryTest in Drupal 8
Same name in this branch
- 8 core/tests/Drupal/KernelTests/Core/Database/QueryTest.php \Drupal\KernelTests\Core\Database\QueryTest
- 8 core/modules/views_ui/tests/src/Functional/QueryTest.php \Drupal\Tests\views_ui\Functional\QueryTest
- 8 core/modules/views/tests/src/Kernel/Plugin/QueryTest.php \Drupal\Tests\views\Kernel\Plugin\QueryTest
- 8 core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php \Drupal\Tests\Core\Entity\Query\Sql\QueryTest
- 8 core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php \Drupal\views_test_data\Plugin\views\query\QueryTest
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php \Drupal\Tests\Core\Entity\Query\Sql\QueryTest
- 10 core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php \Drupal\Tests\Core\Entity\Query\Sql\QueryTest
@coversDefaultClass \Drupal\Core\Entity\Query\Sql\Query @group Entity
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\Core\Entity\Query\Sql\QueryTest
Expanded class hierarchy of QueryTest
1 string reference to 'QueryTest'
- QueryTest::calculateDependencies in core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ query/ QueryTest.php - Calculates dependencies for the configured plugin.
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ Query/ Sql/ QueryTest.php, line 14
Namespace
Drupal\Tests\Core\Entity\Query\SqlView source
class QueryTest extends UnitTestCase {
/**
* The query object.
*
* @var \Drupal\Core\Entity\Query\Sql\Query
*/
protected $query;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$entity_type = new EntityType([
'id' => 'example_entity_query',
]);
$conjunction = 'AND';
$connection = $this
->getMockBuilder('Drupal\\Core\\Database\\Connection')
->disableOriginalConstructor()
->getMock();
$namespaces = [
'Drupal\\Core\\Entity\\Query\\Sql',
];
$this->query = new Query($entity_type, $conjunction, $connection, $namespaces);
}
/**
* Tests entity query for entity type without base table.
*
* @covers ::prepare
*/
public function testNoBaseTable() {
$this
->expectException(QueryException::class);
$this
->expectExceptionMessage('No base table for example_entity_query, invalid query.');
$this->query
->execute();
}
/**
* Tests revision entity query for entity type without revision table.
*
* @covers ::prepare
*/
public function testNoRevisionTable() {
$this
->expectException(QueryException::class);
$this
->expectExceptionMessage('No revision table for example_entity_query, invalid query.');
$this->query
->allRevisions()
->execute();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
QueryTest:: |
protected | property | The query object. | |
QueryTest:: |
protected | function |
Overrides UnitTestCase:: |
|
QueryTest:: |
public | function | Tests entity query for entity type without base table. | |
QueryTest:: |
public | function | Tests revision entity query for entity type without revision table. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. |