function EntityFieldQueryTestCase::assertEntityFieldQuery in Drupal 7
Fetches the results of an EntityFieldQuery and compares.
Parameters
$query: An EntityFieldQuery to run.
$intended_results: A list of results, every entry is again a list, first being the entity type, the second being the entity_id.
$message: The message to be displayed as the result of this test.
$ordered: If FALSE then the result of EntityFieldQuery will match $intended_results even if the order is not the same. If TRUE then order should match too.
7 calls to EntityFieldQueryTestCase::assertEntityFieldQuery()
- EntityFieldQueryTestCase::testEntityFieldQuery in modules/
simpletest/ tests/ entity_query.test - Tests EntityFieldQuery.
- EntityFieldQueryTestCase::testEntityFieldQueryDisablePager in modules/
simpletest/ tests/ entity_query.test - Tests disabling the pager in EntityFieldQuery.
- EntityFieldQueryTestCase::testEntityFieldQueryMetaConditions in modules/
simpletest/ tests/ entity_query.test - Tests field meta conditions.
- EntityFieldQueryTestCase::testEntityFieldQueryPager in modules/
simpletest/ tests/ entity_query.test - Tests the pager integration of EntityFieldQuery.
- EntityFieldQueryTestCase::testEntityFieldQueryRouting in modules/
simpletest/ tests/ entity_query.test - Tests the routing feature of EntityFieldQuery.
File
- modules/
simpletest/ tests/ entity_query.test, line 1644 - Unit test file for the entity API.
Class
- EntityFieldQueryTestCase
- Tests EntityFieldQuery.
Code
function assertEntityFieldQuery($query, $intended_results, $message, $ordered = FALSE) {
$results = array();
try {
foreach ($query
->execute() as $entity_type => $entity_ids) {
foreach ($entity_ids as $entity_id => $stub_entity) {
$results[] = array(
$entity_type,
$entity_id,
);
}
}
if (!isset($ordered) || !$ordered) {
sort($results);
sort($intended_results);
}
$this
->assertEqual($results, $intended_results, $message);
} catch (Exception $e) {
$this
->fail('Exception thrown: ' . $e
->getMessage());
}
}