Issue #3135027 by mondrake, Spokje, ayushmishra206, rajandro, nitesh624: Replace usages of assertArrayEquals, deprecate it
parent
c107f0a137
commit
47355e3ba7
|
@ -144,7 +144,7 @@ class MailHandlerTest extends UnitTestCase {
|
|||
$this->assertEquals($key, $result['key']);
|
||||
$this->assertEquals($to, $result['to']);
|
||||
$this->assertEquals($langcode, $result['langcode']);
|
||||
$this->assertArrayEquals($params, $result['params']);
|
||||
$this->assertEquals($params, $result['params']);
|
||||
$this->assertEquals($from, $result['from']);
|
||||
});
|
||||
$this->userStorage->expects($this->any())
|
||||
|
|
|
@ -18,7 +18,7 @@ class RequirementsExceptionTest extends UnitTestCase {
|
|||
*/
|
||||
public function testGetRequirements() {
|
||||
$exception = new RequirementsException('Missing requirements ', ['requirements' => $this->missingRequirements]);
|
||||
$this->assertArrayEquals(['requirements' => $this->missingRequirements], $exception->getRequirements());
|
||||
$this->assertEquals(['requirements' => $this->missingRequirements], $exception->getRequirements());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -200,7 +200,7 @@ abstract class MigrateTestCase extends UnitTestCase {
|
|||
if (empty($expected_value && $actual_value)) {
|
||||
return;
|
||||
}
|
||||
$this->assertArrayEquals($expected_value, $actual_value, $message);
|
||||
$this->assertEquals($expected_value, $actual_value, $message);
|
||||
}
|
||||
else {
|
||||
$this->assertSame((string) $expected_value, (string) $actual_value, $message);
|
||||
|
|
|
@ -123,7 +123,7 @@ class MigrationTest extends UnitTestCase {
|
|||
|
||||
$requirements = ['test_a', 'test_b', 'test_c', 'test_d'];
|
||||
$migration->setRequirements($requirements);
|
||||
$this->assertArrayEquals($requirements, $migration->getRequirements());
|
||||
$this->assertEquals($requirements, $migration->getRequirements());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -366,7 +366,7 @@ class RowTest extends UnitTestCase {
|
|||
*/
|
||||
public function testGetMultiple(array $keys, array $expected_values) {
|
||||
$row = $this->createRowWithDestinationProperties($this->testGetSourceProperties, $this->testGetSourceIds, $this->testGetDestinationProperties);
|
||||
$this->assertArrayEquals(array_combine($keys, $expected_values), $row->getMultiple($keys));
|
||||
$this->assertEquals(array_combine($keys, $expected_values), $row->getMultiple($keys));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -166,7 +166,7 @@ class SubProcessTest extends MigrateTestCase {
|
|||
// values ended up in the proper destinations, and that the value of the
|
||||
// key (@id) is the same as the destination ID (42).
|
||||
$new_value = $plugin->transform($current_value, $migrate_executable, $row, 'test');
|
||||
$this->assertArrayEquals([], $new_value);
|
||||
$this->assertSame([], $new_value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,7 +36,7 @@ class RestResourceConfigTest extends UnitTestCase {
|
|||
'configuration' => $configuration,
|
||||
], 'rest_resource_config');
|
||||
|
||||
$this->assertArrayEquals($expected, $entity->getMethods());
|
||||
$this->assertEquals($expected, $entity->getMethods());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,10 +59,10 @@ class ViewTest extends UnitTestCase {
|
|||
$this->viewHandler->view->storage = $view_this;
|
||||
|
||||
$this->viewHandler->options['view_to_insert'] = 'other:default';
|
||||
$this->assertArrayEquals(['config' => ['view.other']], $this->viewHandler->calculateDependencies());
|
||||
$this->assertEquals(['config' => ['view.other']], $this->viewHandler->calculateDependencies());
|
||||
|
||||
$this->viewHandler->options['view_to_insert'] = 'this:default';
|
||||
$this->assertArrayEquals([], $this->viewHandler->calculateDependencies());
|
||||
$this->assertSame([], $this->viewHandler->calculateDependencies());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,8 +82,8 @@ class WorkflowTest extends UnitTestCase {
|
|||
$workflow = new Workflow(['id' => 'test', 'type' => 'test_type'], 'workflow');
|
||||
|
||||
// Getting states works when there are none.
|
||||
$this->assertArrayEquals([], array_keys($workflow->getTypePlugin()->getStates()));
|
||||
$this->assertArrayEquals([], array_keys($workflow->getTypePlugin()->getStates([])));
|
||||
$this->assertSame([], $workflow->getTypePlugin()->getStates());
|
||||
$this->assertSame([], $workflow->getTypePlugin()->getStates([]));
|
||||
|
||||
$workflow
|
||||
->getTypePlugin()
|
||||
|
@ -92,7 +92,7 @@ class WorkflowTest extends UnitTestCase {
|
|||
->addState('archived', 'Archived');
|
||||
|
||||
// States are stored in alphabetical key order.
|
||||
$this->assertArrayEquals([
|
||||
$this->assertEquals([
|
||||
'archived',
|
||||
'draft',
|
||||
'published',
|
||||
|
@ -102,21 +102,21 @@ class WorkflowTest extends UnitTestCase {
|
|||
$this->assertInstanceOf(State::class, $workflow->getTypePlugin()->getStates()['draft']);
|
||||
|
||||
// Passing in no IDs returns all states.
|
||||
$this->assertArrayEquals(['draft', 'published', 'archived'], array_keys($workflow->getTypePlugin()->getStates()));
|
||||
$this->assertEquals(['draft', 'published', 'archived'], array_keys($workflow->getTypePlugin()->getStates()));
|
||||
|
||||
// The order of states is by weight.
|
||||
$workflow->getTypePlugin()->setStateWeight('published', -1);
|
||||
$this->assertArrayEquals(['published', 'draft', 'archived'], array_keys($workflow->getTypePlugin()->getStates()));
|
||||
$this->assertEquals(['published', 'draft', 'archived'], array_keys($workflow->getTypePlugin()->getStates()));
|
||||
|
||||
// The label is also used for sorting if weights are equal.
|
||||
$workflow->getTypePlugin()->setStateWeight('archived', 0);
|
||||
$this->assertArrayEquals(['published', 'archived', 'draft'], array_keys($workflow->getTypePlugin()->getStates()));
|
||||
$this->assertEquals(['published', 'archived', 'draft'], array_keys($workflow->getTypePlugin()->getStates()));
|
||||
|
||||
// You can limit the states returned by passing in states IDs.
|
||||
$this->assertArrayEquals(['archived', 'draft'], array_keys($workflow->getTypePlugin()->getStates(['draft', 'archived'])));
|
||||
$this->assertEquals(['archived', 'draft'], array_keys($workflow->getTypePlugin()->getStates(['draft', 'archived'])));
|
||||
|
||||
// An empty array does not load all states.
|
||||
$this->assertArrayEquals([], array_keys($workflow->getTypePlugin()->getStates([])));
|
||||
$this->assertSame([], $workflow->getTypePlugin()->getStates([]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -394,8 +394,8 @@ class WorkflowTest extends UnitTestCase {
|
|||
$workflow = new Workflow(['id' => 'test', 'type' => 'test_type'], 'workflow');
|
||||
|
||||
// Getting transitions works when there are none.
|
||||
$this->assertArrayEquals([], array_keys($workflow->getTypePlugin()->getTransitions()));
|
||||
$this->assertArrayEquals([], array_keys($workflow->getTypePlugin()->getTransitions([])));
|
||||
$this->assertSame([], $workflow->getTypePlugin()->getTransitions());
|
||||
$this->assertSame([], $workflow->getTypePlugin()->getTransitions([]));
|
||||
|
||||
// By default states are ordered in the order added.
|
||||
$workflow
|
||||
|
@ -406,29 +406,29 @@ class WorkflowTest extends UnitTestCase {
|
|||
->addTransition('a_a', 'A to A', ['a'], 'a');
|
||||
|
||||
// Transitions are stored in alphabetical key order in configuration.
|
||||
$this->assertArrayEquals(['a_a', 'a_b'], array_keys($workflow->getTypePlugin()->getConfiguration()['transitions']));
|
||||
$this->assertEquals(['a_a', 'a_b'], array_keys($workflow->getTypePlugin()->getConfiguration()['transitions']));
|
||||
|
||||
// Ensure we're returning transition objects.
|
||||
$this->assertInstanceOf(Transition::class, $workflow->getTypePlugin()->getTransitions()['a_a']);
|
||||
|
||||
// Passing in no IDs returns all transitions.
|
||||
$this->assertArrayEquals(['a_b', 'a_a'], array_keys($workflow->getTypePlugin()->getTransitions()));
|
||||
$this->assertEquals(['a_b', 'a_a'], array_keys($workflow->getTypePlugin()->getTransitions()));
|
||||
|
||||
// The order of states is by weight.
|
||||
$workflow->getTypePlugin()->setTransitionWeight('a_a', -1);
|
||||
$this->assertArrayEquals(['a_a', 'a_b'], array_keys($workflow->getTypePlugin()->getTransitions()));
|
||||
$this->assertEquals(['a_a', 'a_b'], array_keys($workflow->getTypePlugin()->getTransitions()));
|
||||
|
||||
// If all weights are equal it will fallback to labels.
|
||||
$workflow->getTypePlugin()->setTransitionWeight('a_a', 0);
|
||||
$this->assertArrayEquals(['a_a', 'a_b'], array_keys($workflow->getTypePlugin()->getTransitions()));
|
||||
$this->assertEquals(['a_a', 'a_b'], array_keys($workflow->getTypePlugin()->getTransitions()));
|
||||
$workflow->getTypePlugin()->setTransitionLabel('a_b', 'A B');
|
||||
$this->assertArrayEquals(['a_b', 'a_a'], array_keys($workflow->getTypePlugin()->getTransitions()));
|
||||
$this->assertEquals(['a_b', 'a_a'], array_keys($workflow->getTypePlugin()->getTransitions()));
|
||||
|
||||
// You can limit the states returned by passing in states IDs.
|
||||
$this->assertArrayEquals(['a_a'], array_keys($workflow->getTypePlugin()->getTransitions(['a_a'])));
|
||||
$this->assertEquals(['a_a'], array_keys($workflow->getTypePlugin()->getTransitions(['a_a'])));
|
||||
|
||||
// An empty array does not load all states.
|
||||
$this->assertArrayEquals([], array_keys($workflow->getTypePlugin()->getTransitions([])));
|
||||
$this->assertSame([], $workflow->getTypePlugin()->getTransitions([]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -172,7 +172,7 @@ class BatchBuilderTest extends UnitTestCase {
|
|||
->setQueue('BatchName', '\Drupal\Core\Queue\Batch')
|
||||
->toArray();
|
||||
|
||||
$this->assertArrayEquals([
|
||||
$this->assertEquals([
|
||||
'name' => 'BatchName',
|
||||
'class' => '\Drupal\Core\Queue\Batch',
|
||||
], $batch['queue'], 'Batch queue has been set.');
|
||||
|
|
|
@ -22,7 +22,7 @@ class NullStorageTest extends UnitTestCase {
|
|||
$this->assertInstanceOf(StorageInterface::class, $collection);
|
||||
$this->assertEquals(StorageInterface::DEFAULT_COLLECTION, $nullStorage->getCollectionName());
|
||||
$this->assertEquals('test', $collection->getCollectionName());
|
||||
$this->assertArrayEquals([], $collection->getAllCollectionNames());
|
||||
$this->assertSame([], $collection->getAllCollectionNames());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class StorageCopyTraitTest extends UnitTestCase {
|
|||
$source = new MemoryStorage();
|
||||
$target = new MemoryStorage();
|
||||
// Empty the storage should be the same.
|
||||
$this->assertArrayEquals(self::toArray($source), self::toArray($target));
|
||||
$this->assertEquals(self::toArray($source), self::toArray($target));
|
||||
|
||||
// When the source is populated, they are not the same any more.
|
||||
$this->generateRandomData($source, $source_collections);
|
||||
|
@ -54,9 +54,9 @@ class StorageCopyTraitTest extends UnitTestCase {
|
|||
// After copying they are the same, this asserts that items not present
|
||||
// in the source get removed from the target.
|
||||
self::replaceStorageContents($source, $target);
|
||||
$this->assertArrayEquals($source_data, self::toArray($target));
|
||||
$this->assertEquals($source_data, self::toArray($target));
|
||||
// Assert that the copy method did indeed not change the source.
|
||||
$this->assertArrayEquals($source_data, self::toArray($source));
|
||||
$this->assertEquals($source_data, self::toArray($source));
|
||||
|
||||
// Assert that the active collection is the same as the original source.
|
||||
$this->assertEquals($source_name, $source->getCollectionName());
|
||||
|
@ -154,7 +154,7 @@ class StorageCopyTraitTest extends UnitTestCase {
|
|||
$this->assertFalse($target->exists($name));
|
||||
}
|
||||
else {
|
||||
$this->assertArrayEquals($source->read($name), $target->read($name));
|
||||
$this->assertEquals($source->read($name), $target->read($name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -412,7 +412,7 @@ class DateTest extends UnitTestCase {
|
|||
'max-age' => $max_age,
|
||||
],
|
||||
];
|
||||
$this->assertArrayEquals($expected, $object->toRenderable());
|
||||
$this->assertEquals($expected, $object->toRenderable());
|
||||
|
||||
// Test retrieving the formatted time difference string.
|
||||
$this->assertEquals($string, $object->getString());
|
||||
|
|
|
@ -598,7 +598,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase {
|
|||
->willReturnArgument(0);
|
||||
|
||||
// Exercise getFields().
|
||||
$this->assertArrayEquals(
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$mock_base->getFields($include_computed)
|
||||
);
|
||||
|
|
|
@ -27,7 +27,7 @@ class EntityConstraintViolationListTest extends UnitTestCase {
|
|||
|
||||
$this->assertSame($constraint_list->filterByFields(['name']), $constraint_list);
|
||||
$this->assertCount(4, $constraint_list);
|
||||
$this->assertArrayEquals(array_values(iterator_to_array($constraint_list)), [$violations[2], $violations[3], $violations[4], $violations[5]]);
|
||||
$this->assertEquals(array_values(iterator_to_array($constraint_list)), [$violations[2], $violations[3], $violations[4], $violations[5]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ class EntityConstraintViolationListTest extends UnitTestCase {
|
|||
|
||||
$this->assertSame($constraint_list->filterByFields(['name']), $constraint_list);
|
||||
$this->assertCount(4, $constraint_list);
|
||||
$this->assertArrayEquals(array_values(iterator_to_array($constraint_list)), [$violations[2], $violations[3], $violations[4], $violations[5]]);
|
||||
$this->assertEquals(array_values(iterator_to_array($constraint_list)), [$violations[2], $violations[3], $violations[4], $violations[5]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,7 @@ class EntityConstraintViolationListTest extends UnitTestCase {
|
|||
|
||||
$this->assertSame($constraint_list->filterByFieldAccess($account), $constraint_list);
|
||||
$this->assertCount(4, $constraint_list);
|
||||
$this->assertArrayEquals(array_values(iterator_to_array($constraint_list)), [$violations[2], $violations[3], $violations[4], $violations[5]]);
|
||||
$this->assertEquals(array_values(iterator_to_array($constraint_list)), [$violations[2], $violations[3], $violations[4], $violations[5]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,7 +72,7 @@ class EntityConstraintViolationListTest extends UnitTestCase {
|
|||
|
||||
$this->assertSame($constraint_list->filterByFieldAccess($account), $constraint_list);
|
||||
$this->assertCount(4, $constraint_list);
|
||||
$this->assertArrayEquals(array_values(iterator_to_array($constraint_list)), [$violations[2], $violations[3], $violations[4], $violations[5]]);
|
||||
$this->assertEquals(array_values(iterator_to_array($constraint_list)), [$violations[2], $violations[3], $violations[4], $violations[5]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -349,7 +349,7 @@ class FieldItemListTest extends UnitTestCase {
|
|||
$field_list->expects($this->never())
|
||||
->method('getValue');
|
||||
|
||||
$this->assertArrayEquals([], $field_list->defaultValuesFormSubmit([], $form, $form_state));
|
||||
$this->assertSame([], $field_list->defaultValuesFormSubmit([], $form, $form_state));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase {
|
|||
|
||||
$expected = $definitions['non_container_aware_discovery'];
|
||||
$expected['id'] = 'non_container_aware_discovery:test_discovery_1';
|
||||
$this->assertArrayEquals($expected, $returned_definitions['non_container_aware_discovery:test_discovery_1']);
|
||||
$this->assertEquals($expected, $returned_definitions['non_container_aware_discovery:test_discovery_1']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,7 +252,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase {
|
|||
|
||||
$expected = $base_definition;
|
||||
$expected['id'] = 'non_container_aware_discovery:test_discovery_1';
|
||||
$this->assertArrayEquals($expected, $discovery->getDefinition('non_container_aware_discovery:test_discovery_1'));
|
||||
$this->assertEquals($expected, $discovery->getDefinition('non_container_aware_discovery:test_discovery_1'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ class AttributeTest extends UnitTestCase {
|
|||
// Test adding array to class.
|
||||
$attribute = new Attribute();
|
||||
$attribute->setAttribute('class', ['kitten', 'cat']);
|
||||
$this->assertArrayEquals(['kitten', 'cat'], $attribute['class']->value());
|
||||
$this->assertEquals(['kitten', 'cat'], $attribute['class']->value());
|
||||
|
||||
// Test adding boolean attributes.
|
||||
$attribute = new Attribute();
|
||||
|
@ -174,19 +174,19 @@ class AttributeTest extends UnitTestCase {
|
|||
|
||||
// Add one class on empty attribute.
|
||||
$attribute->addClass('banana');
|
||||
$this->assertArrayEquals(['banana'], $attribute['class']->value());
|
||||
$this->assertEquals(['banana'], $attribute['class']->value());
|
||||
|
||||
// Add one class.
|
||||
$attribute->addClass('aa');
|
||||
$this->assertArrayEquals(['banana', 'aa'], $attribute['class']->value());
|
||||
$this->assertEquals(['banana', 'aa'], $attribute['class']->value());
|
||||
|
||||
// Add multiple classes.
|
||||
$attribute->addClass('xx', 'yy');
|
||||
$this->assertArrayEquals(['banana', 'aa', 'xx', 'yy'], $attribute['class']->value());
|
||||
$this->assertEquals(['banana', 'aa', 'xx', 'yy'], $attribute['class']->value());
|
||||
|
||||
// Add an array of classes.
|
||||
$attribute->addClass(['red', 'green', 'blue']);
|
||||
$this->assertArrayEquals(['banana', 'aa', 'xx', 'yy', 'red', 'green', 'blue'], $attribute['class']->value());
|
||||
$this->assertEquals(['banana', 'aa', 'xx', 'yy', 'red', 'green', 'blue'], $attribute['class']->value());
|
||||
|
||||
// Add an array of duplicate classes.
|
||||
$attribute->addClass(['red', 'green', 'blue'], ['aa', 'aa', 'banana'], 'yy');
|
||||
|
@ -218,7 +218,7 @@ class AttributeTest extends UnitTestCase {
|
|||
$attribute->removeClass('gg');
|
||||
$this->assertNotContains(['gg'], $attribute['class']->value());
|
||||
// Test that the array index remains sequential.
|
||||
$this->assertArrayEquals(['aa'], $attribute['class']->value());
|
||||
$this->assertEquals(['aa'], $attribute['class']->value());
|
||||
|
||||
$attribute->removeClass('aa');
|
||||
$this->assertEmpty((string) $attribute);
|
||||
|
@ -254,7 +254,7 @@ class AttributeTest extends UnitTestCase {
|
|||
->addClass(['apple', 'lime', 'grapefruit'])
|
||||
->addClass(['banana']);
|
||||
$expected = ['example-class', 'blue', 'apple', 'lime', 'grapefruit', 'banana'];
|
||||
$this->assertArrayEquals($expected, $attribute['class']->value(), 'Attributes chained');
|
||||
$this->assertEquals($expected, $attribute['class']->value(), 'Attributes chained');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -49,7 +49,7 @@ class JUnitConverterTest extends UnitTestCase {
|
|||
public function testXmlToRowsEmptyFile() {
|
||||
// File system with an empty XML file.
|
||||
vfsStream::setup('junit_test', NULL, ['empty.xml' => '']);
|
||||
$this->assertArrayEquals([], JUnitConverter::xmlToRows(23, vfsStream::url('junit_test/empty.xml')));
|
||||
$this->assertSame([], JUnitConverter::xmlToRows(23, vfsStream::url('junit_test/empty.xml')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,7 +76,7 @@ EOD;
|
|||
'file' => '/Users/paul/projects/drupal/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php',
|
||||
],
|
||||
];
|
||||
$this->assertArrayEquals($simpletest, JUnitConverter::xmlElementToRows(23, new \SimpleXMLElement($junit)));
|
||||
$this->assertEquals($simpletest, JUnitConverter::xmlElementToRows(23, new \SimpleXMLElement($junit)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ EOD;
|
|||
'line' => 108,
|
||||
'file' => '/Users/paul/projects/drupal/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php',
|
||||
];
|
||||
$this->assertArrayEquals($simpletest, JUnitConverter::convertTestCaseToSimpletestRow(23, new \SimpleXMLElement($junit)));
|
||||
$this->assertEquals($simpletest, JUnitConverter::convertTestCaseToSimpletestRow(23, new \SimpleXMLElement($junit)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -81,11 +81,11 @@ COMPOUND
|
|||
*/
|
||||
public function testGetTestListFromFile() {
|
||||
$parser = new TestFileParser();
|
||||
$this->assertArrayEquals(
|
||||
$this->assertEquals(
|
||||
['Drupal\Tests\Core\Test\RunTests\TestFileParserTest'],
|
||||
$parser->getTestListFromFile(__FILE__)
|
||||
);
|
||||
$this->assertArrayEquals(
|
||||
$this->assertEquals(
|
||||
['Drupal\KernelTests\Core\Datetime\Element\TimezoneTest'],
|
||||
$parser->getTestListFromFile(__DIR__ . '/../../../../KernelTests/Core/Datetime/Element/TimezoneTest.php')
|
||||
);
|
||||
|
|
|
@ -190,7 +190,7 @@ class RegistryTest extends UnitTestCase {
|
|||
$reflection_method->setAccessible(TRUE);
|
||||
$reflection_method->invokeArgs($this->registry, [&$hooks, $theme->reveal()]);
|
||||
|
||||
$this->assertArrayEquals($expected, $hooks);
|
||||
$this->assertEquals($expected, $hooks);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,8 +87,14 @@ abstract class UnitTestCase extends TestCase {
|
|||
* @param array $expected
|
||||
* @param array $actual
|
||||
* @param string $message
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
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 : '');
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests;
|
||||
|
||||
/**
|
||||
* Tests for the UnitTestCase class.
|
||||
*
|
||||
* @group Tests
|
||||
*/
|
||||
class UnitTestCaseTest extends UnitTestCase {
|
||||
|
||||
/**
|
||||
* Tests deprecation of the ::assertArrayEquals method.
|
||||
*
|
||||
* @group legacy
|
||||
* @expectedDeprecation Drupal\Tests\UnitTestCase::assertArrayEquals() 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
|
||||
*/
|
||||
public function testAssertArrayEquals() {
|
||||
$this->assertArrayEquals([], []);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue