comparison core/modules/comment/tests/src/Functional/CommentLinksTest.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
103 103
104 // Change weight to make links go before comment body. 104 // Change weight to make links go before comment body.
105 entity_get_display('comment', 'comment', 'default') 105 entity_get_display('comment', 'comment', 'default')
106 ->setComponent('links', ['weight' => -100]) 106 ->setComponent('links', ['weight' => -100])
107 ->save(); 107 ->save();
108 $this->drupalGet($this->node->urlInfo()); 108 $this->drupalGet($this->node->toUrl());
109 $element = $this->cssSelect('article.js-comment > div'); 109 $element = $this->cssSelect('article.js-comment > div');
110 // Get last child element. 110 // Get last child element.
111 $element = end($element); 111 $element = end($element);
112 $this->assertIdentical($element->getTagName(), 'div', 'Last element is comment body.'); 112 $this->assertIdentical($element->getTagName(), 'div', 'Last element is comment body.');
113 113
114 // Change weight to make links go after comment body. 114 // Change weight to make links go after comment body.
115 entity_get_display('comment', 'comment', 'default') 115 entity_get_display('comment', 'comment', 'default')
116 ->setComponent('links', ['weight' => 100]) 116 ->setComponent('links', ['weight' => 100])
117 ->save(); 117 ->save();
118 $this->drupalGet($this->node->urlInfo()); 118 $this->drupalGet($this->node->toUrl());
119 $element = $this->cssSelect('article.js-comment > div'); 119 $element = $this->cssSelect('article.js-comment > div');
120 // Get last child element. 120 // Get last child element.
121 $element = end($element); 121 $element = end($element);
122 $this->assertNotEmpty($element->find('css', 'ul.links'), 'Last element is comment links.'); 122 $this->assertNotEmpty($element->find('css', 'ul.links'), 'Last element is comment links.');
123 123
124 // Make sure we can hide node links. 124 // Make sure we can hide node links.
125 entity_get_display('node', $this->node->bundle(), 'default') 125 entity_get_display('node', $this->node->bundle(), 'default')
126 ->removeComponent('links') 126 ->removeComponent('links')
127 ->save(); 127 ->save();
128 $this->drupalGet($this->node->urlInfo()); 128 $this->drupalGet($this->node->toUrl());
129 $this->assertNoLink('1 comment'); 129 $this->assertNoLink('1 comment');
130 $this->assertNoLink('Add new comment'); 130 $this->assertNoLink('Add new comment');
131 131
132 // Visit the full node, make sure there are links for the comment. 132 // Visit the full node, make sure there are links for the comment.
133 $this->drupalGet('node/' . $this->node->id()); 133 $this->drupalGet('node/' . $this->node->id());