Skip to content

Commit

Permalink
Add test to ensure that Sort is calculated on BaseElement values rath…
Browse files Browse the repository at this point in the history
…er than static
  • Loading branch information
robbieaverill committed Nov 19, 2018
1 parent 5f064f4 commit 0dab0ed
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/BaseElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,20 @@ public function testStyleVariants()
$element->Style = 'old';
$this->assertEquals('', $element->getStyleVariant());
}

public function testOnBeforeWrite()
{
$element1 = new ElementContent();
$element1->write();
$baselineSort = $element1->Sort;

$element2 = new ElementContent();
$element2->write();
$this->assertEquals($baselineSort + 1, $element2->Sort, 'Sort order should be higher than the max');

// Use a different element type, ensuring that sort orders are relative to the BaseElement
$element3 = new TestElement();
$element3->write();
$this->assertEquals($baselineSort + 2, $element3->Sort, 'Sort order should be higher than the max');
}
}

0 comments on commit 0dab0ed

Please sign in to comment.