You are here

protected function ViewTestBase::helperButtonHasLabel in Drupal 8

Same name in this branch
  1. 8 core/modules/views/src/Tests/ViewTestBase.php \Drupal\views\Tests\ViewTestBase::helperButtonHasLabel()
  2. 8 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,
  ]));
}