You are here

function PanelizerTestHelper::compareDisplayPanes in Panelizer 7.3

Compare panes from two different displays to make sure they're the same.

Parameters

object $panelizer1: The first display object.

object $panelizer2: The second display object.

2 calls to PanelizerTestHelper::compareDisplayPanes()
PanelizerNodeTest::testCloningDefaults in tests/panelizer.node.test
Make sure that cloning a default display works correctly.
PanelizerNodeTest::testNodeCustomDisplay in tests/panelizer.node.test
Confirm that overriding a default display works correctly.

File

tests/panelizer.helper.test, line 190
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 compareDisplayPanes($panelizer1, $panelizer2) {
  $this
    ->verbose('<pre>' . print_r(func_get_args(), TRUE) . '</pre>');

  // Confirm the UUID values are different.
  // @todo Dependent upon https://www.drupal.org/node/2750545.
  // $this->assertNotEqual($panelizer1->display->uuid, $panelizer2->display->uuid);
  // Make simpler structure of the two display's panes, to make them easier to
  // examine later.
  $panes1 = array();
  $panes2 = array();
  foreach ($panelizer1->display->content as $key => $pane) {
    $panes1[] = $pane;
  }
  foreach ($panelizer2->display->content as $key => $pane) {
    $panes2[] = $pane;
  }

  // Compare the two sets of panes.
  foreach ($panes1 as $key => $pane) {

    // Verify that the pane exists in the second display.
    $this
      ->assertTrue(isset($panes2[$key]));

    // Confirm the two panes are of the same type.
    $this
      ->assertEqual($pane->type, $panes2[$key]->type);
    $this
      ->assertEqual($pane->subtype, $panes2[$key]->subtype);

    // Confirm the pid values are different.
    $this
      ->assertNotEqual($pane->pid, $panes2[$key]->pid);

    // Confirm the UUID values are different.
    // @todo Dependent upon https://www.drupal.org/node/2750545.
    // $this->assertNotEqual($pane->uuid, $panes2[$key]->uuid);
  }
}