You are here

protected function NameTestBase::assertNameFormats in Name Field 8

Helper function.

@todo describe this method.

1 call to NameTestBase::assertNameFormats()
NameTestBase::assertNameFormat in tests/src/Functional/NameTestBase.php
Helper function.

File

tests/src/Functional/NameTestBase.php, line 96

Class

NameTestBase
Helper test class with some added functions for testing.

Namespace

Drupal\Tests\name\Functional

Code

protected function assertNameFormats($name_components, $type, $object, array $names, array $options = []) {
  foreach ($names as $format => $expected) {
    $value = \Drupal::service('name.format_parser')
      ->parse($name_components, $format);
    $this
      ->assertIdentical($value, $expected, t("Name value for '@name' was '@actual', expected value '@expected'. Components were: %components", [
      '@name' => $format,
      '@actual' => $value,
      '@expected' => $expected,
      '%components' => implode(' ', $name_components),
    ]));
  }
}