protected function ViewTestBase::helperButtonHasLabel in Drupal 8
Same name in this branch
- 8 core/modules/views/src/Tests/ViewTestBase.php \Drupal\views\Tests\ViewTestBase::helperButtonHasLabel()
- 8 core/modules/views/tests/src/Functional/ViewTestBase.php \Drupal\Tests\views\Functional\ViewTestBase::helperButtonHasLabel()
Same name and namespace in other branches
- 9 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.
Throws
\Behat\Mink\Exception\ElementNotFoundException
5 calls to ViewTestBase::helperButtonHasLabel()
- ExposedFormTest::testInputRequired in core/
modules/ views/ tests/ src/ Functional/ Plugin/ ExposedFormTest.php - Test the input required exposed form type.
- ExposedFormTest::testResetButton in core/
modules/ views/ tests/ src/ Functional/ Plugin/ ExposedFormTest.php - Tests whether the reset button works on an exposed form.
- ExposedFormTest::testSubmitButton in core/
modules/ views/ tests/ src/ Functional/ Plugin/ ExposedFormTest.php - Tests the submit button.
- ExposedFormUITest::testExposedAdminUi in core/
modules/ views_ui/ tests/ src/ Functional/ ExposedFormUITest.php - Tests the admin interface of exposed filter and sort items.
- ExposedFormUITest::testGroupedFilterAdminUi in core/
modules/ views_ui/ tests/ src/ Functional/ ExposedFormUITest.php - Tests the admin interface of exposed grouped filters.
File
- core/
modules/ views/ tests/ src/ Functional/ ViewTestBase.php, line 106
Class
- ViewTestBase
- Defines a base class for Views testing in the full web test environment.
Namespace
Drupal\Tests\views\FunctionalCode
protected function helperButtonHasLabel($id, $expected_label, $message = 'Label has the expected value: %label.') {
$xpath = $this
->assertSession()
->buildXPathQuery('//button[@id=:value]|//input[@id=:value]', [
':value' => $id,
]);
$field = $this
->getSession()
->getPage()
->find('xpath', $xpath);
if (empty($field)) {
throw new ElementNotFoundException($this
->getSession()
->getDriver(), 'form field', 'id', $field);
}
$this
->assertEquals($expected_label, $field
->getValue());
}