Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Tests\node\Functional;
|
Chris@0
|
4
|
Chris@0
|
5 /**
|
Chris@0
|
6 * Tests that the post information (submitted by Username on date) text displays
|
Chris@0
|
7 * appropriately.
|
Chris@0
|
8 *
|
Chris@0
|
9 * @group node
|
Chris@0
|
10 */
|
Chris@0
|
11 class NodePostSettingsTest extends NodeTestBase {
|
Chris@0
|
12
|
Chris@0
|
13 protected function setUp() {
|
Chris@0
|
14 parent::setUp();
|
Chris@0
|
15
|
Chris@0
|
16 $web_user = $this->drupalCreateUser(['create page content', 'administer content types', 'access user profiles']);
|
Chris@0
|
17 $this->drupalLogin($web_user);
|
Chris@0
|
18 }
|
Chris@0
|
19
|
Chris@0
|
20 /**
|
Chris@0
|
21 * Confirms "Basic page" content type and post information is on a new node.
|
Chris@0
|
22 */
|
Chris@0
|
23 public function testPagePostInfo() {
|
Chris@0
|
24
|
Chris@0
|
25 // Set "Basic page" content type to display post information.
|
Chris@0
|
26 $edit = [];
|
Chris@0
|
27 $edit['display_submitted'] = TRUE;
|
Chris@0
|
28 $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
|
Chris@0
|
29
|
Chris@0
|
30 // Create a node.
|
Chris@0
|
31 $edit = [];
|
Chris@0
|
32 $edit['title[0][value]'] = $this->randomMachineName(8);
|
Chris@0
|
33 $edit['body[0][value]'] = $this->randomMachineName(16);
|
Chris@0
|
34 $this->drupalPostForm('node/add/page', $edit, t('Save'));
|
Chris@0
|
35
|
Chris@0
|
36 // Check that the post information is displayed.
|
Chris@0
|
37 $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
|
Chris@0
|
38 $elements = $this->xpath('//div[contains(@class, :class)]', [':class' => 'node__submitted']);
|
Chris@0
|
39 $this->assertEqual(count($elements), 1, 'Post information is displayed.');
|
Chris@0
|
40 $node->delete();
|
Chris@0
|
41
|
Chris@0
|
42 // Set "Basic page" content type to display post information.
|
Chris@0
|
43 $edit = [];
|
Chris@0
|
44 $edit['display_submitted'] = FALSE;
|
Chris@0
|
45 $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
|
Chris@0
|
46
|
Chris@0
|
47 // Create a node.
|
Chris@0
|
48 $edit = [];
|
Chris@0
|
49 $edit['title[0][value]'] = $this->randomMachineName(8);
|
Chris@0
|
50 $edit['body[0][value]'] = $this->randomMachineName(16);
|
Chris@0
|
51 $this->drupalPostForm('node/add/page', $edit, t('Save'));
|
Chris@0
|
52
|
Chris@0
|
53 // Check that the post information is displayed.
|
Chris@0
|
54 $elements = $this->xpath('//div[contains(@class, :class)]', [':class' => 'node__submitted']);
|
Chris@0
|
55 $this->assertEqual(count($elements), 0, 'Post information is not displayed.');
|
Chris@0
|
56 }
|
Chris@0
|
57
|
Chris@0
|
58 }
|