8000 discardChanges: Discards relations (test) · thecodingmachine/tdbm@603e031 · GitHub
[go: up one dir, main page]

Skip to content

Commit 603e031

Browse files
committed
discardChanges: Discards relations (test)
1 parent 10516d8 commit 603e031

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/TDBMDaoGeneratorTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,28 @@ public function testDiscardChanges(): void
11511151
$this->assertEquals($oldName, $contactBean->getName());
11521152
}
11531153

1154+
/**
1155+
* @depends testDaoGeneration
1156+
*/
1157+
public function testDiscardChangesDiscardsRelations(): void
1158+
{
1159+
$countryDao = new CountryDao($this->tdbmService);
1160+
$countryBean = $countryDao->getById(1);
1161+
1162+
$oldCount = $countryBean->getBoatsByAnchorageCountry()->count();
1163+
1164+
$this->tdbmService->getConnection()->insert('boats', [
1165+
'name' => 'RoseBud2',
1166+
'anchorage_country' => 1,
1167+
'current_country' => 1,
1168+
'length' => '13.5',
1169+
]);
1170+
1171+
$countryBean->discardChanges();
1172+
1173+
$this->assertEquals($oldCount + 1, $countryBean->getBoatsByAnchorageCountry()->count());
1174+
}
1175+
11541176
/**
11551177
* @depends testDaoGeneration
11561178
*/

0 commit comments

Comments
 (0)
0