Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* @file
* Definition of Drupal\node\Tests\NodePostSettingsTest.
*/
namespace Drupal\node\Tests;
/**
* Check that the post information displays when enabled for a content type.
*/
class NodePostSettingsTest extends NodeTestBase {
public static function getInfo() {
return array(
'name' => 'Node post information display',
'description' => 'Check that the post information (submitted by Username on date) text displays appropriately.',
'group' => 'Node',
);
}
function setUp() {
parent::setUp();
$web_user = $this->drupalCreateUser(array('create page content', 'administer content types', 'access user profiles'));
$this->drupalLogin($web_user);
}
/**
* Set "Basic page" content type to display post information and confirm its presence on a new node.
*/
function testPagePostInfo() {
// Set "Basic page" content type to display post information.
$edit = array();
$edit['node_submitted'] = TRUE;
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
// Create a node.
$edit = array();
$langcode = LANGUAGE_NOT_SPECIFIED;
$edit["title"] = $this->randomName(8);
$edit["body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the post information is displayed.
$node = $this->drupalGetNodeByTitle($edit["title"]);
$elements = $this->xpath('//*[contains(@class,:class)]', array(':class' => 'submitted'));
Jennifer Hodgdon
committed
$this->assertEqual(count($elements), 1, 'Post information is displayed.');
}
/**
* Set "Basic page" content type to not display post information and confirm its absence on a new node.
*/
function testPageNotPostInfo() {
// Set "Basic page" content type to display post information.
$edit = array();
$edit['node_submitted'] = FALSE;
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
// Create a node.
$edit = array();
$langcode = LANGUAGE_NOT_SPECIFIED;
$edit["title"] = $this->randomName(8);
$edit["body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the post information is displayed.
$node = $this->drupalGetNodeByTitle($edit["title"]);
Jennifer Hodgdon
committed
$this->assertNoRaw('<span class="submitted">', 'Post information is not displayed.');