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