Skip to content

Commit

Permalink
ENH Let unit tests manipulate the DB before loading fixtures (#11182)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Apr 1, 2024
1 parent 46c5f6d commit b442d9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Dev/SapphireTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ public function getRequireDefaultRecordsFrom()
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:
Expand Down
1 change: 1 addition & 0 deletions src/Dev/State/FixtureTestState.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function setUp(SapphireTest $test)
$instance->augmentDefaultRecords();
}
}
$test->onBeforeLoadFixtures();
$this->loadFixtures($test);
}

Expand Down

0 comments on commit b442d9d

Please sign in to comment.