You are here

public function NameTestHelper::assertNameFormats in Name Field 7

Same name and namespace in other branches
  1. 6 tests/name.test \NameTestHelper::assertNameFormats()
2 calls to NameTestHelper::assertNameFormats()
NameTestHelper::assertNameFormat in tests/name.test
NameUnitTestCase::testGetInvalidTokens in tests/name.test
Test name_format().

File

tests/name.test, line 56
Tests for the name module.

Class

NameTestHelper
Helper test class with some added functions for testing.

Code

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