You are here

protected function TestBase::assertIdentical in SimpleTest 8.3

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.

4 calls to TestBase::assertIdentical()
KernelTestBaseTest::testSetUp in src/Tests/KernelTestBaseTest.php
Tests expected behavior of setUp().
SimpleTestTest::stubTest in src/Tests/SimpleTestTest.php
Test to be run and the results confirmed.
UiPhpUnitOutputTest::testOutput in src/Tests/UiPhpUnitOutputTest.php
Tests that PHPUnit output in the Simpletest UI looks good.
WebTestBase::drupalPostAjaxForm in src/WebTestBase.php
Executes an Ajax form submission.

File

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);
}