update
This commit is contained in:
@@ -40,7 +40,7 @@ class MenuLinkReorderTest extends BrowserTestBase {
|
||||
|
||||
// Assert that the Home link is available.
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertLink('Home');
|
||||
$this->assertSession()->linkExists('Home');
|
||||
|
||||
// The administrator user that can re-order menu links.
|
||||
$this->administrator = $this->drupalCreateUser([
|
||||
@@ -58,14 +58,14 @@ class MenuLinkReorderTest extends BrowserTestBase {
|
||||
|
||||
// The link is still there.
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertLink('Home');
|
||||
$this->assertSession()->linkExists('Home');
|
||||
|
||||
// Clear all caches.
|
||||
$this->drupalPostForm('admin/config/development/performance', [], t('Clear all caches'));
|
||||
|
||||
// Clearing all caches should not affect the state of the menu link.
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertLink('Home');
|
||||
$this->assertSession()->linkExists('Home');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,10 @@ class MenuUiLanguageTest extends BrowserTestBase {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->drupalLogin($this->drupalCreateUser(['access administration pages', 'administer menu']));
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'access administration pages',
|
||||
'administer menu',
|
||||
]));
|
||||
|
||||
// Add some custom languages.
|
||||
foreach (['aa', 'bb', 'cc', 'cs'] as $language_code) {
|
||||
|
||||
@@ -141,7 +141,7 @@ class MenuUiNodeTest extends BrowserTestBase {
|
||||
$node = $this->drupalGetNodeByTitle($node_title);
|
||||
// Assert that there is no link for the node.
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertNoLink($node_title);
|
||||
$this->assertSession()->linkNotExists($node_title);
|
||||
|
||||
// Edit the node, enable the menu link setting, but skip the link title.
|
||||
$edit = [
|
||||
@@ -150,7 +150,7 @@ class MenuUiNodeTest extends BrowserTestBase {
|
||||
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
|
||||
// Assert that there is no link for the node.
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertNoLink($node_title);
|
||||
$this->assertSession()->linkNotExists($node_title);
|
||||
|
||||
// Make sure the menu links only appear when the node is published.
|
||||
// These buttons just appear for 'administer nodes' users.
|
||||
@@ -171,12 +171,12 @@ class MenuUiNodeTest extends BrowserTestBase {
|
||||
];
|
||||
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertNoLink($node_title, 'Found no menu link with the node unpublished');
|
||||
$this->assertSession()->linkNotExists($node_title, 'Found no menu link with the node unpublished');
|
||||
// Assert that the link exists if published.
|
||||
$edit['status[value]'] = TRUE;
|
||||
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertLink($node_title, 0, 'Found a menu link with the node published');
|
||||
$this->assertSession()->linkExists($node_title, 0, 'Found a menu link with the node published');
|
||||
|
||||
// Log back in as normal user.
|
||||
$this->drupalLogin($this->editor);
|
||||
@@ -189,7 +189,7 @@ class MenuUiNodeTest extends BrowserTestBase {
|
||||
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
|
||||
// Assert that the link exists.
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertLink($node_title);
|
||||
$this->assertSession()->linkExists($node_title);
|
||||
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->assertFieldById('edit-menu-weight', 17, 'Menu weight correct in edit form');
|
||||
@@ -213,7 +213,7 @@ class MenuUiNodeTest extends BrowserTestBase {
|
||||
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
|
||||
// Assert that there is no link for the node.
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertNoLink($node_title);
|
||||
$this->assertSession()->linkNotExists($node_title);
|
||||
|
||||
// Add a menu link to the Administration menu.
|
||||
$item = MenuLinkContent::create([
|
||||
@@ -335,11 +335,11 @@ class MenuUiNodeTest extends BrowserTestBase {
|
||||
|
||||
// Assert that the original link exists in the frontend.
|
||||
$this->drupalGet('node/' . $node->id(), ['language' => $languages[$langcodes[0]]]);
|
||||
$this->assertLink($node_title);
|
||||
$this->assertSession()->linkExists($node_title);
|
||||
|
||||
// Assert that the translated link exists in the frontend.
|
||||
$this->drupalGet('node/' . $node->id(), ['language' => $languages[$langcodes[1]]]);
|
||||
$this->assertLink($translated_node_title);
|
||||
$this->assertSession()->linkExists($translated_node_title);
|
||||
|
||||
// Revisit the edit page in original language, check the loaded menu item title and save.
|
||||
$options = ['language' => $languages[$langcodes[0]]];
|
||||
|
||||
@@ -88,7 +88,12 @@ class MenuUiTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
|
||||
|
||||
// Create users.
|
||||
$this->adminUser = $this->drupalCreateUser(['access administration pages', 'administer blocks', 'administer menu', 'create article content']);
|
||||
$this->adminUser = $this->drupalCreateUser([
|
||||
'access administration pages',
|
||||
'administer blocks',
|
||||
'administer menu',
|
||||
'create article content',
|
||||
]);
|
||||
$this->authenticatedUser = $this->drupalCreateUser([]);
|
||||
}
|
||||
|
||||
@@ -557,7 +562,13 @@ class MenuUiTest extends BrowserTestBase {
|
||||
* Tests that menu items pointing to unpublished nodes are editable.
|
||||
*/
|
||||
public function testUnpublishedNodeMenuItem() {
|
||||
$this->drupalLogin($this->drupalCreateUser(['access administration pages', 'administer blocks', 'administer menu', 'create article content', 'bypass node access']));
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'access administration pages',
|
||||
'administer blocks',
|
||||
'administer menu',
|
||||
'create article content',
|
||||
'bypass node access',
|
||||
]));
|
||||
// Create an unpublished node.
|
||||
$node = $this->drupalCreateNode([
|
||||
'type' => 'article',
|
||||
@@ -704,7 +715,7 @@ class MenuUiTest extends BrowserTestBase {
|
||||
if (isset($parent)) {
|
||||
// Verify menu link.
|
||||
$title = $parent->getTitle();
|
||||
$this->assertLink($title, 0, 'Parent menu link was displayed');
|
||||
$this->assertSession()->linkExists($title, 0, 'Parent menu link was displayed');
|
||||
|
||||
// Verify menu link link.
|
||||
$this->clickLink($title);
|
||||
@@ -714,7 +725,7 @@ class MenuUiTest extends BrowserTestBase {
|
||||
|
||||
// Verify menu link.
|
||||
$title = $item->getTitle();
|
||||
$this->assertLink($title, 0, 'Menu link was displayed');
|
||||
$this->assertSession()->linkExists($title, 0, 'Menu link was displayed');
|
||||
|
||||
// Verify menu link link.
|
||||
$this->clickLink($title);
|
||||
|
||||
Reference in New Issue
Block a user