You are here

public function ProtectedNodePageDisplay::testContentTypeWithGlobalDescriptionSet in Protected Node 7

Same name and namespace in other branches
  1. 1.0.x tests/protected_node.page_text.test \ProtectedNodePageDisplay::testContentTypeWithGlobalDescriptionSet()

Test function.

Test that the password page description per content type is displayed instead instead of the global description.

File

tests/protected_node.page_text.test, line 134
Test protected node password page display options.

Class

ProtectedNodePageDisplay
Configure protected_node to use per node password.

Code

public function testContentTypeWithGlobalDescriptionSet() {
  $global_description = $this
    ->randomName(32);
  $content_type_description = $this
    ->randomName(16);

  // Set global text.
  $this
    ->drupalLogin($this->adminUser);
  $protected_node_settings = array(
    'protected_node_use_global_password' => PROTECTED_NODE_PER_NODE_PASSWORD,
    'protected_node_description' => $global_description,
  );
  $this
    ->drupalPost('admin/config/content/protected_node', $protected_node_settings, t('Save configuration'));

  // Set content type text.
  $settings = array(
    'protected_node_description' => $content_type_description,
  );
  $this
    ->drupalPost('admin/structure/types/manage/page', $settings, t('Save content type'));

  // $show_title_option_available is FALSE since there is a custom description
  // set.
  $node = $this
    ->createProtectedNode(FALSE);

  // User sees the set content type text.
  $this
    ->drupalLogin($this->normalAccessAllowedUser);
  $this
    ->drupalGet('node/' . $node->nid);
  $this
    ->assertText($content_type_description, "Custom content type description displayed instead of the global description on the enter password page", $this->group);
}