Drupal\Tests\UnitTestCase::assertArrayEquals() is deprecated in drupal:9.1.0

  13x: 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

    3x in RulesDebugLoggerChannelTest::testLog from Drupal\Tests\rules\Unit
    2x in SystemMessageTest::testActionExecution from Drupal\Tests\rules\Unit\Integration\RulesAction
    1x in DataListItemAddTest::testActionExecutionWithDefaults from Drupal\Tests\rules\Unit\Integration\RulesAction
    1x in DataListItemAddTest::testActionExecutionItemAppend from Drupal\Tests\rules\Unit\Integration\RulesAction
    1x in DataListItemAddTest::testActionExecutionItemPrepend from Drupal\Tests\rules\Unit\Integration\RulesAction
    1x in DataListItemAddTest::testActionExecutionEnforceUnique from Drupal\Tests\rules\Unit\Integration\RulesAction
    1x in DataListItemAddTest::testActionExecutionNonUnique from Drupal\Tests\rules\Unit\Integration\RulesAction
    1x in DataListItemRemoveTest::testActionExecution from Drupal\Tests\rules\Unit\Integration\RulesAction
    1x in SystemMessageTest::testOptionalRepeat from Drupal\Tests\rules\Unit\Integration\RulesAction
    1x in RulesConditionContainerTest::testAddExpressionObject from Drupal\Tests\rules\Unit

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

CommentFileSizeAuthor
#5 3189035-5.patch5.72 KBPooja Ganjage
#2 3189035-2.patch5.13 KBPooja Ganjage

Comments

jonathan1055 created an issue. See original summary.

Pooja Ganjage’s picture

StatusFileSize
new5.13 KB

Hi,

Tried to creating a patch for this issue.

Please review the patch.

Let me know if any suggestions.

Thanks.

Pooja Ganjage’s picture

Status: Active » Needs review
jonathan1055’s picture

Hi Pooja,

Thanks for the patch. It looks fine and you have found all the 11 ocurrences of assertArrayEquals()

Just wondering if you noticed that I had actually assigned this issue to myself and was doing the work when you posted your patch. Usually if someone assigns an issue to themselves it means they are working on the solution, and this is done to avoid wasted duplicated effort. My time working on this is now wasted as you have also done the same work. It's fine, as it was not a long job, but if I had known you were going to do this I could have done something else. Or if I had taken too long to produce a patch you could have taken the issue over and assigned it to yourself (which you are welcome to do, now) so that I would have known you were about to start work.

Anyway, back to the patch. To prove that all the deprecations of this type are removed you need to add in to your patch a new file drupalci.yml which has suppress-deprecations: false - you can use exactly this file https://www.drupal.org/files/issues/2020-02-03/3089502-24.show_deprecati... then run the combined patch at Core 9.1. There will be other deprecations as on https://www.drupal.org/pift-ci-job/1920453 but there should be none for assertArrayEquals()

Jonathan

Pooja Ganjage’s picture

StatusFileSize
new5.72 KB

Hi Jonathan,

Sorry for the inconvenience that I was did issue that were you working for it, but as you suggested, I am creating a patch for it.

Please review the patch.

Thanks.

jonathan1055’s picture

Status: Needs review » Reviewed & tested by the community

Thank you Pooja, no worries :-)

Nice work, the new patch proves that you have removed this deprecation, because even though there are deprecation failures at 9.1 none of them are for assertArrayEquals(). I also confirm that apart from the drupalci.yml temporary change, patch #5 is identical to #2.

So this is RTBC for patch #2.

  • TR committed eb2b208 on 8.x-3.x authored by Pooja Ganjage
    Issue #3189035 by Pooja Ganjage, jonathan1055: [9.1] UnitTestCase::...
tr’s picture

Status: Reviewed & tested by the community » Fixed

Committed #2. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.