diff --git a/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php b/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php index 80ed5cd17e5..ae4bb832f27 100644 --- a/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php @@ -27,6 +27,7 @@ class PartitionedQueryBuilderTest extends TestCase { protected function setUp(): void { if (PHP_INT_SIZE < 8) { $this->markTestSkipped('Test requires 64bit'); + return; } $this->connection = Server::get(IDBConnection::class); $this->shardConnectionManager = Server::get(ShardConnectionManager::class); @@ -36,7 +37,11 @@ class PartitionedQueryBuilderTest extends TestCase { } protected function tearDown(): void { - $this->cleanupDb(); + // PHP unit also runs tearDown when the test is skipped, but we only initialized when using 64bit + // see https://github.com/sebastianbergmann/phpunit/issues/6394 + if (PHP_INT_SIZE >= 8) { + $this->cleanupDb(); + } parent::tearDown(); } diff --git a/tests/lib/Repair/RepairCollationTest.php b/tests/lib/Repair/RepairCollationTest.php index ea6e70b2164..11fbecb0171 100644 --- a/tests/lib/Repair/RepairCollationTest.php +++ b/tests/lib/Repair/RepairCollationTest.php @@ -31,7 +31,6 @@ class TestCollationRepair extends Collation { /** * Tests for the converting of MySQL tables to InnoDB engine * - * * @see \OC\Repair\RepairMimeTypes */ #[\PHPUnit\Framework\Attributes\Group('DB')] @@ -48,13 +47,13 @@ class RepairCollationTest extends TestCase { parent::setUp(); $this->connection = Server::get(ConnectionAdapter::class); - $this->config = Server::get(IConfig::class); if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_MYSQL) { $this->markTestSkipped('Test only relevant on MySql'); + return; } $this->logger = $this->createMock(LoggerInterface::class); - + $this->config = Server::get(IConfig::class); $dbPrefix = $this->config->getSystemValueString('dbtableprefix'); $this->tableName = $this->getUniqueID($dbPrefix . '_collation_test'); $this->connection->prepare("CREATE TABLE $this->tableName(text VARCHAR(16)) COLLATE utf8_unicode_ci")->execute(); @@ -63,7 +62,11 @@ class RepairCollationTest extends TestCase { } protected function tearDown(): void { - $this->connection->getInner()->createSchemaManager()->dropTable($this->tableName); + $this->connection = Server::get(ConnectionAdapter::class); + if ($this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_MYSQL) { + // tear down only needed on MySQL + $this->connection->getInner()->createSchemaManager()->dropTable($this->tableName); + } parent::tearDown(); }