ENH Let unit tests manipulate the DB before loading fixtures (#11182)

This commit is contained in:
Guy Sartorelli 2024-04-02 11:28:06 +13:00 committed by GitHub
parent 46c5f6d9ed
commit b442d9d45a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -251,6 +251,14 @@ abstract class SapphireTest extends TestCase implements TestOnly
return $this->requireDefaultRecordsFrom;
}
/**
* Called after the database is created, but before fixtures are loaded.
*/
public function onBeforeLoadFixtures(): void
{
// no-op - this method is intended to be overridden by subclasses.
}
/**
* Setup the test.
* Always sets up in order:

View File

@ -63,6 +63,7 @@ class FixtureTestState implements TestState
$instance->augmentDefaultRecords();
}
}
$test->onBeforeLoadFixtures();
$this->loadFixtures($test);
}