Skip to content

Commit

Permalink
FIX: Make test comparison less brittle in MigrateSiteTreeLinkingTaskTest
Browse files Browse the repository at this point in the history
Comparing every single field is unnecessary and brittle, only the IDs
need to be compared.

Notably this tripped over a potential bug fix in
silverstripe/silverstripe-framework#8591
but the change should be incorporated regardless.
  • Loading branch information
Sam Minnee committed May 28, 2019
1 parent 60b2947 commit 469e7ca
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/php/Tasks/MigrateSiteTreeLinkingTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ public function testLinkingMigration()
$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());
}
}

0 comments on commit 469e7ca

Please sign in to comment.