You are here

protected function TestBase::assertNotIdentical in Drupal 8

Check to see if two values are not 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.

3 calls to TestBase::assertNotIdentical()
GenericCacheBackendUnitTestBase::testDeleteMultiple in core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
Test Drupal\Core\Cache\CacheBackendInterface::delete() and Drupal\Core\Cache\CacheBackendInterface::deleteMultiple().
KernelTestBaseTest::setUp in core/modules/simpletest/src/Tests/KernelTestBaseTest.php
Performs setup tasks before each individual test method is run.
SimpleTestTest::setUp in core/modules/simpletest/src/Tests/SimpleTestTest.php
Sets up a Drupal site for running functional and integration tests.

File

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

Class

TestBase
Base class for Drupal tests.

Namespace

Drupal\simpletest

Code

protected function assertNotIdentical($first, $second, $message = '', $group = 'Other') {
  $not_identical = $first !== $second;
  if (!$not_identical || !$message) {
    $default_message = new FormattableMarkup('Value @first is not 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($not_identical, $message, $group);
}