You are here

protected function TestBase::assertIdentical in Drupal 8

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\Render\FormattableMarkup 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.

12 calls to TestBase::assertIdentical()
EntityCacheTagsTestBase::verifyRenderCache in core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
Verify that a given render cache entry exists, with the correct cache tags.
GenericCacheBackendUnitTestBase::testDelete in core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
Tests Drupal\Core\Cache\CacheBackendInterface::delete().
GenericCacheBackendUnitTestBase::testDeleteMultiple in core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
Test Drupal\Core\Cache\CacheBackendInterface::delete() and Drupal\Core\Cache\CacheBackendInterface::deleteMultiple().
GenericCacheBackendUnitTestBase::testGetMultiple in core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
Tests Drupal\Core\Cache\CacheBackendInterface::getMultiple().
GenericCacheBackendUnitTestBase::testSetGet in core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
Tests the get and set methods of Drupal\Core\Cache\CacheBackendInterface.

... See full list

File

core/modules/simpletest/src/TestBase.php, line 653

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 = new FormattableMarkup('Value @first is identical to value @second.', [
      '@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);
}