Commit a14e48a1 authored by catch's avatar catch
Browse files

Issue #3139406 by mondrake, mohrerao, longwave, rahulrasgon, Suresh Prabhu...

Issue #3139406 by mondrake, mohrerao, longwave, rahulrasgon, Suresh Prabhu Parkala, jungle, ravi.shankar, Hardik_Patel_12, Bunty Badgujar, paulocs: Replace usages of AssertLegacyTrait::assert(No)FieldByName, that is deprecated
parent 77ce58a2
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -2,8 +2,6 @@

namespace Drupal\Tests\aggregator\Functional;

use Drupal\Component\Render\FormattableMarkup;

/**
 * Tests aggregator admin pages.
 *
@@ -41,8 +39,9 @@ public function testSettingsPage() {
    $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration'));
    $this->assertText(t('The configuration options have been saved.'));

    // Check that settings have the correct default value.
    foreach ($edit as $name => $value) {
      $this->assertFieldByName($name, $value, new FormattableMarkup('"@name" has correct default value.', ['@name' => $name]));
      $this->assertSession()->fieldValueEquals($name, $value);
    }

    // Check for our test processor settings form.
@@ -53,7 +52,7 @@ public function testSettingsPage() {
    ];
    $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration'));
    $this->assertText(t('The configuration options have been saved.'));
    $this->assertFieldByName('dummy_length', 100, '"dummy_length" has correct default value.');
    $this->assertSession()->fieldValueEquals('dummy_length', 100);

    // Make sure settings form is still accessible even after uninstalling a module
    // that provides the selected plugins.
+5 −3
Original line number Diff line number Diff line
@@ -277,22 +277,24 @@ public function testContextAwareBlocks() {
   * Tests that the BlockForm populates machine name correctly.
   */
  public function testMachineNameSuggestion() {
    // Check the form uses the raw machine name suggestion when no instance
    // already exists.
    $url = 'admin/structure/block/add/test_block_instantiation/classy';
    $this->drupalGet($url);
    $this->assertFieldByName('id', 'displaymessage', 'Block form uses raw machine name suggestion when no instance already exists.');
    $this->assertSession()->fieldValueEquals('id', 'displaymessage');
    $edit = ['region' => 'content'];
    $this->drupalPostForm($url, $edit, 'Save block');
    $this->assertText('The block configuration has been saved.');

    // Now, check to make sure the form starts by autoincrementing correctly.
    $this->drupalGet($url);
    $this->assertFieldByName('id', 'displaymessage_2', 'Block form appends _2 to plugin-suggested machine name when an instance already exists.');
    $this->assertSession()->fieldValueEquals('id', 'displaymessage_2');
    $this->drupalPostForm($url, $edit, 'Save block');
    $this->assertText('The block configuration has been saved.');

    // And verify that it continues working beyond just the first two.
    $this->drupalGet($url);
    $this->assertFieldByName('id', 'displaymessage_3', 'Block form appends _3 to plugin-suggested machine name when two instances already exist.');
    $this->assertSession()->fieldValueEquals('id', 'displaymessage_3');
  }

  /**
+2 −2
Original line number Diff line number Diff line
@@ -44,8 +44,8 @@ public function testListing() {
    $this->assertSession()->titleEquals('Custom block library | Drupal');

    // Test for the exposed filters.
    $this->assertFieldByName('info');
    $this->assertFieldByName('type');
    $this->assertSession()->fieldExists('info');
    $this->assertSession()->fieldExists('type');

    // Test for the table.
    $element = $this->xpath('//div[@class="layout-content"]//table');
+2 −2
Original line number Diff line number Diff line
@@ -44,8 +44,8 @@ public function testPageEdit() {

    // Load the edit page.
    $this->drupalGet('block/' . $block->id());
    $this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
    $this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
    $this->assertSession()->fieldValueEquals($title_key, $edit[$title_key]);
    $this->assertSession()->fieldValueEquals($body_key, $edit[$body_key]);

    // Edit the content of the block.
    $edit = [];
+2 −2
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ public function testExistingFormat() {
    // Ensure the toolbar buttons configuration value is initialized to the
    // expected default value.
    $expected_buttons_value = json_encode($expected_default_settings['toolbar']['rows']);
    $this->assertFieldByName('editor[settings][toolbar][button_groups]', $expected_buttons_value);
    $this->assertSession()->fieldValueEquals('editor[settings][toolbar][button_groups]', $expected_buttons_value);

    // Ensure the styles textarea exists and is initialized empty.
    $styles_textarea = $this->xpath('//textarea[@name="editor[settings][plugins][stylescombo][styles]"]');
@@ -275,7 +275,7 @@ public function testNewFormat() {
    $ckeditor = $this->container->get('plugin.manager.editor')->createInstance('ckeditor');
    $default_settings = $ckeditor->getDefaultSettings();
    $expected_buttons_value = json_encode($default_settings['toolbar']['rows']);
    $this->assertFieldByName('editor[settings][toolbar][button_groups]', $expected_buttons_value);
    $this->assertSession()->fieldValueEquals('editor[settings][toolbar][button_groups]', $expected_buttons_value);

    // Regression test for https://www.drupal.org/node/2606460.
    $settings = $this->getDrupalSettings();
Loading