X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fviews_ui%2Ftests%2Fsrc%2FFunctional%2FDisplayTest.php;fp=web%2Fcore%2Fmodules%2Fviews_ui%2Fsrc%2FTests%2FDisplayTest.php;h=44724b4211b4436f3fc56c83a4d9aff0318a176f;hp=afb2c7ff069039969ede896bb911930ef28e415f;hb=bfbba508964731508b9bd6d5835c2edc858db95b;hpb=cb9a80db11fc6b014e5b1e693a5a391c95eb5d9a diff --git a/web/core/modules/views_ui/src/Tests/DisplayTest.php b/web/core/modules/views_ui/tests/src/Functional/DisplayTest.php similarity index 77% rename from web/core/modules/views_ui/src/Tests/DisplayTest.php rename to web/core/modules/views_ui/tests/src/Functional/DisplayTest.php index afb2c7ff0..44724b421 100644 --- a/web/core/modules/views_ui/src/Tests/DisplayTest.php +++ b/web/core/modules/views_ui/tests/src/Functional/DisplayTest.php @@ -1,10 +1,8 @@ drupalPostForm(NULL, [], t('Add @display', ['@display' => 'Block'])); $this->assertText('Block'); $this->assertNoText('Block 2'); - - // Views has special form handling in views_ui_form_button_was_clicked() - // to be able to change the submit button text via JS, this simulates what - // the JS is doing. - $this->drupalPostForm(NULL, [], NULL, [], [], NULL, '&op=Block'); - $this->assertText('Block'); - $this->assertText('Block 2'); } /** @@ -94,13 +85,13 @@ class DisplayTest extends UITestBase { $this->drupalGet($path_prefix); $this->assertFalse($this->xpath('//div[contains(@class, :class)]', [':class' => 'views-display-disabled']), 'Make sure the disabled display css class does not appear after initial adding of a view.'); - $this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', '', 'Make sure the disable button is visible.'); - $this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', '', 'Make sure the enable button is not visible.'); + $this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', NULL, 'Make sure the disable button is visible.'); + $this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', NULL, 'Make sure the enable button is not visible.'); $this->drupalPostForm(NULL, [], 'Disable Page'); $this->assertTrue($this->xpath('//div[contains(@class, :class)]', [':class' => 'views-display-disabled']), 'Make sure the disabled display css class appears once the display is marked as such.'); - $this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', '', 'Make sure the disable button is not visible.'); - $this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', '', 'Make sure the enable button is visible.'); + $this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', NULL, 'Make sure the disable button is not visible.'); + $this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', NULL, 'Make sure the enable button is visible.'); $this->drupalPostForm(NULL, [], 'Enable Page'); $this->assertFalse($this->xpath('//div[contains(@class, :class)]', [':class' => 'views-display-disabled']), 'Make sure the disabled display css class does not appears once the display is enabled again.'); } @@ -145,7 +136,7 @@ class DisplayTest extends UITestBase { // Assert that the expected text is found in each area category. foreach ($areas as $type) { $element = $this->xpath('//div[contains(@class, :class)]/div', [':class' => $type]); - $this->assertEqual((string) $element[0], SafeMarkup::format('The selected display type does not use @type plugins', ['@type' => $type])); + $this->assertEqual($element[0]->getHtml(), SafeMarkup::format('The selected display type does not use @type plugins', ['@type' => $type])); } } @@ -160,7 +151,7 @@ class DisplayTest extends UITestBase { // Test the link text displays 'None' and not 'Block 1' $this->drupalGet($path); $result = $this->xpath("//a[contains(@href, :path)]", [':path' => $link_display_path]); - $this->assertEqual($result[0], t('None'), 'Make sure that the link option summary shows "None" by default.'); + $this->assertEqual($result[0]->getHtml(), t('None'), 'Make sure that the link option summary shows "None" by default.'); $this->drupalGet($link_display_path); $this->assertFieldChecked('edit-link-display-0'); @@ -171,7 +162,7 @@ class DisplayTest extends UITestBase { $this->drupalGet($path); $result = $this->xpath("//a[contains(@href, :path)]", [':path' => $link_display_path]); - $this->assertEqual($result[0], 'Page', 'Make sure that the link option summary shows the right linked display.'); + $this->assertEqual($result[0]->getHtml(), 'Page', 'Make sure that the link option summary shows the right linked display.'); $this->drupalPostForm($link_display_path, ['link_display' => 'custom_url', 'link_url' => 'a-custom-url'], t('Apply')); // The form redirects to the master display. @@ -186,40 +177,6 @@ class DisplayTest extends UITestBase { $this->assertFieldByName('link_url', 'a-custom-url'); } - /** - * Tests contextual links on Views page displays. - */ - public function testPageContextualLinks() { - $this->drupalLogin($this->drupalCreateUser(['administer views', 'access contextual links'])); - $view = View::load('test_display'); - $view->enable()->save(); - $this->container->get('router.builder')->rebuildIfNeeded(); - - // When no "main content" block is placed, we find a contextual link - // placeholder for editing just the view. - $this->drupalGet('test-display'); - $id = 'entity.view.edit_form:view=test_display:location=page&name=test_display&display_id=page_1&langcode=en'; - // @see \Drupal\contextual\Tests\ContextualDynamicContextTest:assertContextualLinkPlaceHolder() - $this->assertRaw(' $id]) . '>', format_string('Contextual link placeholder with id @id exists.', ['@id' => $id])); - - // Get server-rendered contextual links. - // @see \Drupal\contextual\Tests\ContextualDynamicContextTest:renderContextualLinks() - $post = ['ids[0]' => $id]; - $response = $this->drupalPostWithFormat('contextual/render', 'json', $post, ['query' => ['destination' => 'test-display']]); - $this->assertResponse(200); - $json = Json::decode($response); - $this->assertIdentical($json[$id], ''); - - // When a "main content" is placed, we still find a contextual link - // placeholder for editing just the view (not the main content block). - // @see system_block_view_system_main_block_alter() - $this->drupalPlaceBlock('system_main_block', ['id' => 'main_content']); - $this->drupalGet('test-display'); - $id = 'entity.view.edit_form:view=test_display:location=page&name=test_display&display_id=page_1&langcode=en'; - // @see \Drupal\contextual\Tests\ContextualDynamicContextTest:assertContextualLinkPlaceHolder() - $this->assertRaw(' $id]) . '>', format_string('Contextual link placeholder with id @id exists.', ['@id' => $id])); - } - /** * Tests that the view status is correctly reflected on the edit form. */