helperButtonHasLabel example

$this->groupFormUiErrors['missing_title_empty_operator'] = 'A label is required for the specified operator.';
  }

  /** * Tests the admin interface of exposed filter and sort items. */
  public function testExposedAdminUi() {
    $edit = [];

    $this->drupalGet('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/filter/type');
    // Be sure that the button is called exposed.     $this->helperButtonHasLabel('edit-options-expose-button-button', 'Expose filter');

    // The first time the filter UI is displayed, the operator and the     // value forms should be shown.     $this->assertSession()->fieldValueEquals('edit-options-operator-in', 'in');
    $this->assertSession()->fieldValueEquals('edit-options-operator-not-in', 'in');
    $this->assertSession()->checkboxNotChecked('edit-options-value-page');
    $this->assertSession()->checkboxNotChecked('edit-options-value-article');

    // Click the Expose filter button.     $this->drupalGet('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/filter/type');
    $this->submitForm($edit, 'Expose filter');
    
$this->nodes[] = $this->drupalCreateNode(['type' => 'page']);
    }
  }

  /** * Tests the submit button. */
  public function testSubmitButton() {
    // Test the submit button value defaults to 'Apply'.     $this->drupalGet('test_exposed_form_buttons');
    $this->assertSession()->statusCodeEquals(200);
    $this->helperButtonHasLabel('edit-submit-test-exposed-form-buttons', 'Apply');

    // Rename the label of the submit button.     $view = Views::getView('test_exposed_form_buttons');
    $view->setDisplay();

    $exposed_form = $view->display_handler->getOption('exposed_form');
    $exposed_form['options']['submit_button'] = $expected_label = $this->randomMachineName();
    $view->display_handler->setOption('exposed_form', $exposed_form);
    $view->save();

    // Make sure the submit button label changed.
Home | Imprint | This part of the site doesn't use cookies.