function ViewTestBase::helperButtonHasLabel

Same name in this branch
  1. 8.9.x core/modules/views/tests/src/Functional/ViewTestBase.php \Drupal\Tests\views\Functional\ViewTestBase::helperButtonHasLabel()
Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/ViewTestBase.php \Drupal\Tests\views\Functional\ViewTestBase::helperButtonHasLabel()
  2. 10 core/modules/views/tests/src/Functional/ViewTestBase.php \Drupal\Tests\views\Functional\ViewTestBase::helperButtonHasLabel()
  3. 11.x core/modules/views/tests/src/Functional/ViewTestBase.php \Drupal\Tests\views\Functional\ViewTestBase::helperButtonHasLabel()

Asserts the existence of a button with a certain ID and label.

Parameters

string $id: The HTML ID of the button

string $expected_label: The expected label for the button.

string $message: (optional) A custom message to display with the assertion. If no custom message is provided, the message will indicate the button label.

Return value

bool TRUE if the assertion was successful, or FALSE on failure.

File

core/modules/views/src/Tests/ViewTestBase.php, line 109

Class

ViewTestBase
Defines a base class for Views testing in the full web test environment.

Namespace

Drupal\views\Tests

Code

protected function helperButtonHasLabel($id, $expected_label, $message = 'Label has the expected value: %label.') {
    return $this->assertFieldById($id, $expected_label, t($message, [
        '%label' => $expected_label,
    ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.