You are here

function PanelizerUserTest::testUserPanelizeIt in Panelizer 7.3

Confirm that individual objects can be panelized.

File

tests/panelizer.user.test, line 111
Panelizer tests.

Class

PanelizerUserTest
Verifies Panelizer configuration options for user entities.

Code

function testUserPanelizeIt() {
  $this
    ->togglePanelizer('user', 'user', 'default', 1, 0, 0);

  // Check that the view mode can be panelized.
  $this
    ->drupalGet('user/' . $this->admin_user->uid . '/panelizer');
  $this
    ->assertResponse(200);
  $this
    ->assertText('Default');
  $this
    ->assertLink('panelize', 0, 'The panelize link for the default view mode appears on the page');
  $this
    ->assertLinkByHref('user/' . $this->admin_user->uid . '/panelizer/default', 0, 'A link to panelize the default view mode appears on the page');

  // Verify that the view mode is not currently panelized.
  $this
    ->drupalGet('user/' . $this->admin_user->uid . '/panelizer/default');
  $this
    ->assertResponse(200);
  $this
    ->assertRaw(t('This %entity is not currently panelized.', array(
    '%entity' => 'User',
  )));

  // Panelize the view mode.
  $this
    ->drupalPost(NULL, array(), t('Panelize it!'));
  $this
    ->assertResponse(200);

  // Check that the view mode has been panelized.
  $this
    ->drupalGet('user/' . $this->admin_user->uid);
  $this
    ->assertResponse(200);
  $this
    ->assertNoText(t('Member for'), 'The user is panelized');

  // This won't be available because there's no default display for the user
  // entity.
  // $elements = $this->xpath('//div[contains(@class,:class)]', array(':class' => 'panelizer-view-mode'));
  // $this->assertEqual(count($elements), 1, 'The user is panelized.');
}