Skip to content

Commit

Permalink
MNT Don't change auto-increment for non mysql database in test (#10906)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Aug 8, 2023
1 parent f345646 commit e29be44
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/php/ORM/DataListEagerLoadingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use InvalidArgumentException;
use LogicException;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Connect\MySQLDatabase;
use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
Expand Down Expand Up @@ -78,6 +79,15 @@ public static function getExtraDataObjects()
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();

// The AUTO_INCREMENT functionality isn't abstracted, and doesn't work with the same syntax in
// other database drivers. But for other drivers we don't care so much if there are overlapping
// IDs because avoiding them is only required to test the PHP logic, not the database driver
// compatibility.
if (!(DB::get_conn() instanceof MySQLDatabase)) {
return;
}

// Set non-zero auto increment offset for each object type so we don't end up with the same IDs across
// the board. If all of the IDs are 0, 1, 2 then we have no way of knowing if we're accidentally mixing
// up relation ID lists between different relation lists for different classes.
Expand Down

0 comments on commit e29be44

Please sign in to comment.