You are here

protected function TestBase::assertIdentical in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/TestBase.php \Drupal\simpletest\TestBase::assertIdentical()

Check to see if two values are identical.

Parameters

$first: The first value to check.

$second: The second value to check.

$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.

$group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Other'; most tests do not override this default.

Return value

TRUE if the assertion succeeded, FALSE otherwise.

564 calls to TestBase::assertIdentical()
AccessRoleTest::testAccessRole in core/modules/user/src/Tests/Views/AccessRoleTest.php
Tests role access plugin.
ActionUnitTest::testDependencies in core/modules/system/src/Tests/Action/ActionUnitTest.php
Tests the dependency calculation of actions.
AreaViewTest::testViewArea in core/modules/views/src/Tests/Handler/AreaViewTest.php
Tests the view area handler.
AttachedAssetsTest::testDynamicLibrary in core/modules/system/src/Tests/Common/AttachedAssetsTest.php
Dynamically defines an asset library and alters it.
AttachedAssetsTest::testLibraryUnknown in core/modules/system/src/Tests/Common/AttachedAssetsTest.php
Tests non-existing libraries.

... See full list

File

core/modules/simpletest/src/TestBase.php, line 746
Contains \Drupal\simpletest\TestBase.

Class

TestBase
Base class for Drupal tests.

Namespace

Drupal\simpletest

Code

protected function assertIdentical($first, $second, $message = '', $group = 'Other') {
  $is_identical = $first === $second;
  if (!$is_identical || !$message) {
    $default_message = SafeMarkup::format('Value @first is identical to value @second.', array(
      '@first' => var_export($first, TRUE),
      '@second' => var_export($second, TRUE),
    ));
    $message = $message ? $message . PHP_EOL . $default_message : $default_message;
  }
  return $this
    ->assert($is_identical, $message, $group);
}