Skip to content

Commit

Permalink
MNT Skip test in MySQL8
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jul 21, 2022
1 parent 674e6d9 commit c31a819
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion tests/php/ORM/DataObjectSchemaGenerationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use SilverStripe\ORM\FieldType\DBEnum;
use SilverStripe\ORM\DataObject;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Connect\MySQLiConnector;
use SilverStripe\ORM\Tests\DataObjectSchemaGenerationTest\SortedObject;
use SilverStripe\ORM\Tests\DataObjectSchemaGenerationTest\TestIndexObject;
use SilverStripe\ORM\Tests\DataObjectSchemaGenerationTest\TestObject;
Expand Down Expand Up @@ -67,17 +68,36 @@ function () {
);
}

private function isMySQL8(): bool
{
$connector = DB::get_conn()->getConnector();
// TEMP - debug in CI
if ($connector instanceof MySQLiConnector) {
var_dump($connector->getVersion());
}
// ^^ delete
if ($connector instanceof MySQLiConnector &&
preg_match('#^8\.#', $connector->getVersion())
) {
return true;
}
return false;
}

/**
* Check that once a schema has been generated, then it doesn't need any more updating
*/
public function testFieldsDontRerequestChanges()
{
// TODO: remove the MySQL8 skip when `int(11)` is no longer the default field type for integers and has been replaced with `int`
if ($this->isMySQL8()) {
$this->markTestSkipped();
}
$schema = DB::get_schema();
$test = $this;
DB::quiet();

// Table will have been initially created by the $extraDataObjects setting

// Verify that it doesn't need to be recreated
$schema->schemaUpdate(
function () use ($test, $schema) {
Expand Down

0 comments on commit c31a819

Please sign in to comment.