You are here

protected function AddressDefaultWidgetTest::assertFieldValues in Address 8

Asserts that the passed field values are correct.

Ignores differences in ordering.

Parameters

array $field_values: The field values.

array $expected_values: The expected values.

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.

2 calls to AddressDefaultWidgetTest::assertFieldValues()
AddressDefaultWidgetTest::assertOptions in tests/src/FunctionalJavascript/AddressDefaultWidgetTest.php
Asserts that a select field has all of the provided options.
AddressDefaultWidgetTest::testFields in tests/src/FunctionalJavascript/AddressDefaultWidgetTest.php
Tests expected and overridden fields.

File

tests/src/FunctionalJavascript/AddressDefaultWidgetTest.php, line 562

Class

AddressDefaultWidgetTest
Tests the default address widget.

Namespace

Drupal\Tests\address\FunctionalJavascript

Code

protected function assertFieldValues(array $field_values, array $expected_values, $message = '') {
  $valid = TRUE;
  if (count($field_values) == count($expected_values)) {
    foreach ($expected_values as $value) {
      if (!in_array($value, $field_values)) {
        $valid = FALSE;
        break;
      }
    }
  }
  else {
    $valid = FALSE;
  }
  $this
    ->assertTrue($valid, $message);
}