Skip to content

Commit

Permalink
simplify test
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed May 27, 2022
1 parent 2866e22 commit e0d88bd
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions tests/ReferenceSqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,23 +403,19 @@ protected function setupDbForTraversing(): Model
public function testReferenceHasOneTraversing(): void
{
$user = $this->setupDbForTraversing();
$user->setOrder('id', 'desc');
$userEntity = $user->load(1);

$firstUserOrders = $userEntity->ref('Company')->ref('Orders');
$firstUserOrders->setOrder('id');

$this->assertSameExportUnordered([
['id' => 1, 'company_id' => '1', 'description' => 'Vinny Company Order 1', 'amount' => 50.0],
['id' => 3, 'company_id' => '1', 'description' => 'Vinny Company Order 2', 'amount' => 15.0],
], $firstUserOrders->export());

$userEntity->unload();
], $userEntity->ref('Company')->ref('Orders')->export());

$this->assertSameExportUnordered([
['id' => 1, 'company_id' => '1', 'description' => 'Vinny Company Order 1', 'amount' => 50.0],
['id' => 2, 'company_id' => '2', 'description' => 'Zoe Company Order', 'amount' => 10.0],
['id' => 3, 'company_id' => '1', 'description' => 'Vinny Company Order 2', 'amount' => 15.0],
], $userEntity->getModel()->ref('Company')->ref('Orders')->setOrder('id')->export());
], $userEntity->getModel()->ref('Company')->ref('Orders')->export());
}

public function testUnloadedEntityTraversingHasOnedEx(): void
Expand Down

0 comments on commit e0d88bd

Please sign in to comment.