From 24daf3ae83880829b43c6e348b247fcbddc0e2c3 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 25 Jul 2022 16:35:28 +1200 Subject: [PATCH 1/2] MNT Skip test if Page class missing --- tests/php/Dev/Validation/RelationValidationTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/php/Dev/Validation/RelationValidationTest.php b/tests/php/Dev/Validation/RelationValidationTest.php index b609b68f0..adc8022e9 100644 --- a/tests/php/Dev/Validation/RelationValidationTest.php +++ b/tests/php/Dev/Validation/RelationValidationTest.php @@ -51,6 +51,9 @@ class RelationValidationTest extends SapphireTest */ 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(); foreach ($config as $name => $value) { From ce46e2da4721883038d8d3b1ebdb0393a5117abb Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 26 Jul 2022 13:54:10 +1200 Subject: [PATCH 2/2] MNT No longer mark tests as skipped if running mysql 8 --- .../ORM/DataObjectSchemaGenerationTest.php | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/tests/php/ORM/DataObjectSchemaGenerationTest.php b/tests/php/ORM/DataObjectSchemaGenerationTest.php index ec40ca059..95e0aa98a 100644 --- a/tests/php/ORM/DataObjectSchemaGenerationTest.php +++ b/tests/php/ORM/DataObjectSchemaGenerationTest.php @@ -3,12 +3,10 @@ namespace SilverStripe\ORM\Tests; use SilverStripe\Core\Config\Config; -use SilverStripe\ORM\Connect\MySQLSchemaManager; use SilverStripe\ORM\DB; 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; @@ -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 */ 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(); @@ -142,10 +125,6 @@ class DataObjectSchemaGenerationTest extends SapphireTest */ 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(); $test = $this; DB::quiet();