You are here

function PanelizerTestHelper::getPanelizerEntityRecords in Panelizer 7.3

Get the {panelizer_entity} records exist for an entity.

Parameters

string $entity_type: The entity type to check.

int $entity_id: The entity's primary ID.

int $revision_id: The entity's revision ID.

Return value

array The records that were found.

2 calls to PanelizerTestHelper::getPanelizerEntityRecords()
PanelizerNodeTest::testNodeCustomDisplay in tests/panelizer.node.test
Confirm that overriding a default display works correctly.
PanelizerWithPathautoTest::testNodeSave in tests/panelizer.with_pathauto.test
Confirm that saving the Panelizer page doesn't remove the Pathauto alias.

File

tests/panelizer.helper.test, line 239
Test integration for the panelizer module.

Class

PanelizerTestHelper
This will be extended by other tests to simplify them and make the code more reusable.

Code

function getPanelizerEntityRecords($entity_type, $entity_id, $revision_id = NULL) {
  $query = db_select('panelizer_entity', 'pe')
    ->fields('pe')
    ->condition('entity_type', $entity_type);

  // If the revision ID was passed in, use it, otherwise use the entity ID.
  if (!empty($revision_id)) {
    $query
      ->condition('revision_id', $revision_id);
  }
  else {
    $query
      ->condition('entity_id', $entity_id);
  }
  $records = $query
    ->orderBy('pe.revision_id')
    ->execute()
    ->fetchAll();

  // Debug output, for local testing.
  $this
    ->verbose('<pre>' . print_r($records, TRUE) . '</pre>');
  return $records;
}