You are here

protected function UnitTestCase::assertArrayEquals in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/UnitTestCase.php \Drupal\Tests\UnitTestCase::assertArrayEquals()

Asserts if two arrays are equal by sorting them first.

Parameters

array $expected:

array $actual:

string $message:

Deprecated

in drupal:9.1.0 and is removed from drupal:10.0.0. Use ::assertEquals, ::assertEqualsCanonicalizing, or ::assertSame instead.

See also

https://www.drupal.org/node/3136304

1 call to UnitTestCase::assertArrayEquals()
UnitTestCaseTest::testAssertArrayEquals in core/tests/Drupal/Tests/UnitTestCaseTest.php
Tests deprecation of the ::assertArrayEquals method.

File

core/tests/Drupal/Tests/UnitTestCase.php, line 112

Class

UnitTestCase
Provides a base class and helpers for Drupal unit tests.

Namespace

Drupal\Tests

Code

protected function assertArrayEquals(array $expected, array $actual, $message = NULL) {
  @trigger_error(__METHOD__ . "() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use ::assertEquals(), ::assertEqualsCanonicalizing(), or ::assertSame() instead. See https://www.drupal.org/node/3136304", E_USER_DEPRECATED);
  ksort($expected);
  ksort($actual);
  $this
    ->assertEquals($expected, $actual, !empty($message) ? $message : '');
}