You are here

function PanelizerTermTest::testTermPanelsDefault in Panelizer 7.3

File

tests/panelizer.term.test, line 155
Panelizer tests.

Class

PanelizerTermTest
Verifies Panelizer configuration options for taxonomy terms.

Code

function testTermPanelsDefault() {
  $view_mode = 'default';
  $this
    ->togglePanelizer('taxonomy_term', $this->vocabulary->machine_name, $view_mode, 1, 1, 0);
  $term = $this
    ->createTestTerm();

  // Verify that the view mode has a default panel.
  $this
    ->drupalGet('admin/structure/taxonomy/panelizer_vocabulary/panelizer');
  $this
    ->assertResponse(200);
  $this
    ->assertLinkByHref('admin/structure/taxonomy/panelizer_vocabulary/panelizer/' . $view_mode, 0, 'User is able to provide default panel for ' . $view_mode);
  $edit = array(
    'layout' => 'twocol_bricks',
  );
  $this
    ->drupalPost('admin/structure/taxonomy/panelizer_vocabulary/panelizer/' . $view_mode . '/layout', $edit, t('Save'));

  // Check that the layout has been set.
  $this
    ->drupalGet('taxonomy/term/' . $term->tid);
  $this
    ->assertResponse(200);
  $elements = $this
    ->xpath('//div[contains(@class,:class)]', array(
    ':class' => 'panel-2col-bricks',
  ));
  $this
    ->assertEqual(count($elements), 1, 'The default term layout has been set.');
}