Skip to content

Commit

Permalink
fix: added tests for the order
Browse files Browse the repository at this point in the history
  • Loading branch information
SLRBot committed Nov 11, 2023
1 parent 923e667 commit 0e0f8ea
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/Doctrine/Tests/ORM/Internal/TopologicalSortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,28 @@ public function testNodesMaintainOrderWhenNoDepencency(): void
self::assertSame(['A', 'B', 'C'], $this->computeResult());
}

public function testNodesMaintainOrderWhenEdgesPermit(): void
{
$this->addNodes( 'A', 'B', 'C');
$this->addEdge('A', 'B');
$this->addEdge('A', 'C');

// Nodes shall maintain the order in which they were added
// when permitted by edges/constraints
self::assertSame(['A', 'B', 'C'], $this->computeResult());
}

public function testNodesMaintainOrderWhenEdgesPermitAndMainNodePersistedLast(): void
{
$this->addNodes( 'B', 'C', 'A');
$this->addEdge('A', 'B');
$this->addEdge('A', 'C');

// Nodes shall maintain the order in which they were added
// when permitted by edges/constraints
self::assertSame(['A', 'B', 'C'], $this->computeResult());
}

public function testDetectSmallCycle(): void
{
$this->addNodes('A', 'B');
Expand Down

0 comments on commit 0e0f8ea

Please sign in to comment.