Fix Domain EntityCollection#73
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds new test patterns to the EntityCollection test to support multi-country UNESCO World Heritage sites. The changes expand test coverage by adding database setup infrastructure and new test data for transnational heritage sites.
- Adds database seeding and teardown methods for proper test isolation
- Introduces new test data arrays for multi-country heritage sites
- Adds new constructor parameters for state parties data to existing entity creation
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| DB::connection('mysql')->statement('SET FOREIGN_KEY_CHECKS=0;'); | ||
| WorldHeritage::truncate(); | ||
| Country::truncate(); | ||
| DB::table('site_state_parties')->truncate(); | ||
| DB::connection('mysql')->statement('SET FOREIGN_KEY_CHECKS=1;'); |
There was a problem hiding this comment.
Hardcoding 'mysql' connection breaks database abstraction. Use the default connection or make it configurable to support different database types in testing.
| DB::connection('mysql')->statement('SET FOREIGN_KEY_CHECKS=0;'); | |
| WorldHeritage::truncate(); | |
| Country::truncate(); | |
| DB::table('site_state_parties')->truncate(); | |
| DB::connection('mysql')->statement('SET FOREIGN_KEY_CHECKS=1;'); | |
| $connection = DB::connection(); | |
| $driver = $connection->getDriverName(); | |
| if ($driver === 'mysql') { | |
| $connection->statement('SET FOREIGN_KEY_CHECKS=0;'); | |
| } | |
| WorldHeritage::truncate(); | |
| Country::truncate(); | |
| DB::table('site_state_parties')->truncate(); | |
| if ($driver === 'mysql') { | |
| $connection->statement('SET FOREIGN_KEY_CHECKS=1;'); | |
| } |
| DB::connection('mysql')->statement('SET FOREIGN_KEY_CHECKS=0;'); | ||
| WorldHeritage::truncate(); | ||
| Country::truncate(); | ||
| DB::table('site_state_parties')->truncate(); | ||
| DB::connection('mysql')->statement('SET FOREIGN_KEY_CHECKS=1;'); |
There was a problem hiding this comment.
Hardcoding 'mysql' connection breaks database abstraction. Use the default connection or make it configurable to support different database types in testing.
| DB::connection('mysql')->statement('SET FOREIGN_KEY_CHECKS=0;'); | |
| WorldHeritage::truncate(); | |
| Country::truncate(); | |
| DB::table('site_state_parties')->truncate(); | |
| DB::connection('mysql')->statement('SET FOREIGN_KEY_CHECKS=1;'); | |
| $driver = DB::getDriverName(); | |
| if ($driver === 'mysql') { | |
| DB::statement('SET FOREIGN_KEY_CHECKS=0;'); | |
| } | |
| WorldHeritage::truncate(); | |
| Country::truncate(); | |
| DB::table('site_state_parties')->truncate(); | |
| if ($driver === 'mysql') { | |
| DB::statement('SET FOREIGN_KEY_CHECKS=1;'); | |
| } |
what i have done