Merge branch '4.11' into 4

This commit is contained in:
Steve Boyd 2022-07-26 16:34:37 +12:00
commit 3547a5600d
2 changed files with 3 additions and 21 deletions

View File

@ -51,6 +51,9 @@ class RelationValidationTest extends SapphireTest
*/ */
public function testIgnoredClass(string $class, ?string $relation, array $config, bool $expected): void public function testIgnoredClass(string $class, ?string $relation, array $config, bool $expected): void
{ {
if (!class_exists($class)) {
$this->markTestSkipped("This test requires the $class class");
}
$service = RelationValidationService::singleton(); $service = RelationValidationService::singleton();
foreach ($config as $name => $value) { foreach ($config as $name => $value) {

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();