MNT No longer mark tests as skipped if running mysql 8

This commit is contained in:
Steve Boyd 2022-07-26 13:54:10 +12:00
parent 92d8180c69
commit ce46e2da47

View File

@ -3,12 +3,10 @@
namespace SilverStripe\ORM\Tests; namespace SilverStripe\ORM\Tests;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\ORM\Connect\MySQLSchemaManager;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBEnum; use SilverStripe\ORM\FieldType\DBEnum;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Connect\MySQLiConnector;
use SilverStripe\ORM\Tests\DataObjectSchemaGenerationTest\SortedObject; use SilverStripe\ORM\Tests\DataObjectSchemaGenerationTest\SortedObject;
use SilverStripe\ORM\Tests\DataObjectSchemaGenerationTest\TestIndexObject; use SilverStripe\ORM\Tests\DataObjectSchemaGenerationTest\TestIndexObject;
use SilverStripe\ORM\Tests\DataObjectSchemaGenerationTest\TestObject; use SilverStripe\ORM\Tests\DataObjectSchemaGenerationTest\TestObject;
@ -68,26 +66,11 @@ class DataObjectSchemaGenerationTest extends SapphireTest
); );
} }
private function isMySQL8(): bool
{
$connector = DB::get_conn()->getConnector();
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 * Check that once a schema has been generated, then it doesn't need any more updating
*/ */
public function testFieldsDontRerequestChanges() 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(); $schema = DB::get_schema();
$test = $this; $test = $this;
DB::quiet(); DB::quiet();
@ -142,10 +125,6 @@ class DataObjectSchemaGenerationTest extends SapphireTest
*/ */
public function testIndexesDontRerequestChanges() public function testIndexesDontRerequestChanges()
{ {
// 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(); $schema = DB::get_schema();
$test = $this; $test = $this;
DB::quiet(); DB::quiet();