createDatabaseInterface(); } public function testGetPartitionMethodReturnsNull(): void { $actual = Partition::getPartitionMethod('database', 'no_partition_method'); self::assertNull($actual); } public function testGetPartitionMethodWithRangeMethod(): void { $actual = Partition::getPartitionMethod('database', 'range_partition_method'); self::assertSame('RANGE', $actual); } /** @param array> $pluginValue */ #[DataProvider('providerForTestHavePartitioning')] #[PreserveGlobalState(false)] #[RunInSeparateProcess] public function testHavePartitioning(bool $expected, int $version, string|false $varValue, array $pluginValue): void { $mock = self::createStub(DatabaseInterface::class); $mock->method('getVersion')->willReturn($version); $mock->method('fetchValue')->willReturn($varValue); $mock->method('fetchResultSimple')->willReturn($pluginValue); DatabaseInterface::$instance = $mock; self::assertSame($expected, Partition::havePartitioning()); } /** * @return array>>> * @psalm-return array}> */ public static function providerForTestHavePartitioning(): array { return [ '5.5.0 with partitioning support' => [true, 50500, '1', []], '5.5.0 without partitioning support' => [false, 50500, '0', []], '5.6.0 with partitioning support' => [ true, 50600, false, [['Name' => 'mysql_native_password'], ['Name' => 'partition'], ['Name' => 'InnoDB']], ], '5.6.0 without partitioning support' => [ false, 50600, false, [['Name' => 'mysql_native_password'], ['Name' => 'InnoDB']], ], '8.0.0' => [true, 80000, false, []], ]; } }