From 469e7ca01bf05a7fe7e87515ddf0d4e188ebf680 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 28 May 2019 12:51:23 +1200 Subject: [PATCH] FIX: Make test comparison less brittle in MigrateSiteTreeLinkingTaskTest Comparing every single field is unnecessary and brittle, only the IDs need to be compared. Notably this tripped over a potential bug fix in https://github.com/silverstripe/silverstripe-framework/pull/8591 but the change should be incorporated regardless. --- tests/php/Tasks/MigrateSiteTreeLinkingTaskTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/php/Tasks/MigrateSiteTreeLinkingTaskTest.php b/tests/php/Tasks/MigrateSiteTreeLinkingTaskTest.php index 2be7d8f4..3fc11312 100644 --- a/tests/php/Tasks/MigrateSiteTreeLinkingTaskTest.php +++ b/tests/php/Tasks/MigrateSiteTreeLinkingTaskTest.php @@ -80,10 +80,10 @@ class MigrateSiteTreeLinkingTaskTest extends SapphireTest $hash = $this->objFromFixture(SiteTree::class, 'hash_link'); // Ensure all links are created - $this->assertListEquals([$about->toMap(), $staff->toMap()], $home->LinkTracking()); - $this->assertListEquals([$home->toMap(), $staff->toMap()], $about->LinkTracking()); - $this->assertListEquals([$home->toMap(), $about->toMap()], $staff->LinkTracking()); - $this->assertListEquals([$home->toMap()], $action->LinkTracking()); - $this->assertListEquals([$home->toMap(), $about->toMap()], $hash->LinkTracking()); + $this->assertListEquals([['ID' => $about->ID], ['ID' => $staff->ID]], $home->LinkTracking()); + $this->assertListEquals([['ID' => $home->ID], ['ID' => $staff->ID]], $about->LinkTracking()); + $this->assertListEquals([['ID' => $home->ID], ['ID' => $about->ID]], $staff->LinkTracking()); + $this->assertListEquals([['ID' => $home->ID]], $action->LinkTracking()); + $this->assertListEquals([['ID' => $home->ID], ['ID' => $about->ID]], $hash->LinkTracking()); } }