protected function AddressDefaultWidgetTest::assertOptions in Address 8
Asserts that a select field has all of the provided options.
Core only has assertOption(), this helper decreases the number of needed assertions.
Parameters
string $id: ID of select field to assert.
array $options: Options to assert.
string $message: (optional) A message to display with the assertion. Do not translate messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed variables in the message text, not t(). If left blank, a default message will be displayed.
3 calls to AddressDefaultWidgetTest::assertOptions()
- AddressDefaultWidgetTest::testCountries in tests/
src/ FunctionalJavascript/ AddressDefaultWidgetTest.php - Tests the country field.
- AddressDefaultWidgetTest::testEvents in tests/
src/ FunctionalJavascript/ AddressDefaultWidgetTest.php - Tests the alter events.
- AddressDefaultWidgetTest::testSubdivisions in tests/
src/ FunctionalJavascript/ AddressDefaultWidgetTest.php - Tests the presence of subdivision dropdowns where expected.
File
- tests/
src/ FunctionalJavascript/ AddressDefaultWidgetTest.php, line 516
Class
- AddressDefaultWidgetTest
- Tests the default address widget.
Namespace
Drupal\Tests\address\FunctionalJavascriptCode
protected function assertOptions($id, array $options, $message = '') {
$elements = $this
->xpath('//select[@name="' . $id . '"]/option');
$found_options = [];
foreach ($elements as $element) {
if ($option = $element
->getValue()) {
$found_options[] = $option;
}
}
$this
->assertFieldValues($found_options, $options, $message);
}