diff --git a/core/modules/menu_ui/src/Tests/MenuLanguageTest.php b/core/modules/menu_ui/tests/src/Functional/MenuLanguageTest.php similarity index 99% rename from core/modules/menu_ui/src/Tests/MenuLanguageTest.php rename to core/modules/menu_ui/tests/src/Functional/MenuLanguageTest.php index 4c48f05da7..efdf3a988d 100644 --- a/core/modules/menu_ui/src/Tests/MenuLanguageTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuLanguageTest.php @@ -1,6 +1,6 @@ drupalGet('admin/structure/types/manage/page'); - $this->assertCacheContext('user.roles:authenticated'); + $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Contexts', 'user.roles:authenticated'); // Verify that the menu link title has the correct maxlength. $max_length = \Drupal::entityManager()->getBaseFieldDefinitions('menu_link_content')['title']->getSetting('max_length'); diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/tests/src/Functional/MenuTest.php similarity index 97% rename from core/modules/menu_ui/src/Tests/MenuTest.php rename to core/modules/menu_ui/tests/src/Functional/MenuTest.php index dde95027bd..c40e4710d2 100644 --- a/core/modules/menu_ui/src/Tests/MenuTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuTest.php @@ -1,10 +1,11 @@ drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default')); - $this->clickLinkPartialName('Place block'); + $this->clickLink('Place block'); $this->assertText($label); // Enable the block. @@ -531,7 +532,7 @@ public function testSystemMenuRename() { // Make sure menu shows up with new name in block addition. $default_theme = $this->config('system.theme')->get('default'); $this->drupalget('admin/structure/block/list/' . $default_theme); - $this->clickLinkPartialName('Place block'); + $this->clickLink('Place block'); $this->assertText($edit['label']); } @@ -557,7 +558,7 @@ public function testUnpublishedNodeMenuItem() { $this->assertNoText($item->getTitle(), "Menu link pointing to unpublished node is only visible to users with 'bypass node access' permission"); // The cache contexts associated with the (in)accessible menu links are // bubbled. See DefaultMenuLinkTreeManipulators::menuLinkCheckAccess(). - $this->assertCacheContext('user.permissions'); + $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Contexts', 'user.permissions'); } /** @@ -577,9 +578,16 @@ public function testBlockContextualLinks() { // Get server-rendered contextual links. // @see \Drupal\contextual\Tests\ContextualDynamicContextTest:renderContextualLinks() $post = ['ids[0]' => $id]; - $response = $this->drupalPost('contextual/render', 'application/json', $post, ['query' => ['destination' => 'test-page']]); - $this->assertResponse(200); - $json = Json::decode($response); + $client = \Drupal::httpClient(); + $url = $this->buildUrl('contextual/render', ['query' => ['destination' => 'test-page']]); + $response = $client->post($url, [ + 'form_params' => $post, + 'headers' => [ + 'Accept' => 'application/json', + ], + ]); + $this->assertEquals(200, $response->getStatusCode()); + $json = Json::decode((string) $response); $this->assertIdentical($json[$id], ''); } @@ -867,13 +875,13 @@ public function testMenuParentsJsAccess() { $admin = $this->drupalCreateUser(['administer menu']); $this->drupalLogin($admin); // Just check access to the callback overall, the POST data is irrelevant. - $this->drupalGetAjax('admin/structure/menu/parents'); + $this->drupalGet('admin/structure/menu/parents', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']], ['X-Requested-With: XMLHttpRequest']); $this->assertResponse(200); // Do standard user tests. // Log in the user. $this->drupalLogin($this->authenticatedUser); - $this->drupalGetAjax('admin/structure/menu/parents'); + $this->drupalGet('admin/structure/menu/parents', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']], ['X-Requested-With: XMLHttpRequest']); $this->assertResponse(403); } diff --git a/core/modules/menu_ui/src/Tests/MenuWebTestBase.php b/core/modules/menu_ui/tests/src/Functional/MenuWebTestBase.php similarity index 94% rename from core/modules/menu_ui/src/Tests/MenuWebTestBase.php rename to core/modules/menu_ui/tests/src/Functional/MenuWebTestBase.php index e0ee98fbf0..b8dfb242d4 100644 --- a/core/modules/menu_ui/src/Tests/MenuWebTestBase.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuWebTestBase.php @@ -1,13 +1,13 @@