function UnitTestCase::assertArrayEquals

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/UnitTestCase.php \Drupal\Tests\UnitTestCase::assertArrayEquals()

Asserts if two arrays are equal by sorting them first.

Parameters

array $expected: An expected results array.

array $actual: The actual array value.

string $message: An optional error 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 115

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.