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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<?php
/**
* @file
* Definition of Drupal\node\Tests\NodePostSettingsTest.
*/
namespace Drupal\node\Tests;
/**
* Checks 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);
}
/**
* Confirms "Basic page" content type and post information is on a new node.
*/
function testPagePostInfo() {
// Set "Basic page" content type to display post information.
$edit = array();
$edit['settings[node][submitted]'] = TRUE;
$this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
// Create a node.
$edit = array();
$edit['title[0][value]'] = $this->randomName(8);
$edit['body[0][value]'] = $this->randomName(16);
$this->drupalPostForm('node/add/page', $edit, t('Save'));
// Check that the post information is displayed.
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
$elements = $this->xpath('//*[contains(@class,:class)]', array(':class' => 'submitted'));
$this->assertEqual(count($elements), 1, 'Post information is displayed.');
$node->delete();
// Set "Basic page" content type to display post information.
$edit = array();
$edit['settings[node][submitted]'] = FALSE;
$this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
// Create a node.
$edit = array();
$edit['title[0][value]'] = $this->randomName(8);
$edit['body[0][value]'] = $this->randomName(16);
$this->drupalPostForm('node/add/page', $edit, t('Save'));
// Check that the post information is displayed.
$elements = $this->xpath('//*[contains(@class,:class)]', array(':class' => 'submitted'));
$this->assertEqual(count($elements), 0, 'Post information is not displayed.');
}
}
|