‪TYPO3CMS  ‪main
PlatformInformationTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Doctrine\DBAL\Platforms\AbstractPlatform as DoctrineAbstractPlatform;
21 use Doctrine\DBAL\Platforms\MariaDBPlatform as DoctrineMariaDBPlatform;
22 use Doctrine\DBAL\Platforms\MySQLPlatform as DoctrineMySQLPlatform;
23 use Doctrine\DBAL\Platforms\PostgreSQLPlatform as DoctrinePostgreSQLPlatform;
24 use Doctrine\DBAL\Platforms\SQLitePlatform as DoctrineSQLitePlatform;
25 use PHPUnit\Framework\Attributes\DataProvider;
26 use PHPUnit\Framework\Attributes\Test;
28 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
29 
30 final class ‪PlatformInformationTest extends UnitTestCase
31 {
35  public static function platformDataProvider(): array
36  {
37  return [
38  'mysql' => [DoctrineMySQLPlatform::class],
39  'mariadb' => [DoctrineMariaDBPlatform::class],
40  'postgresql' => [DoctrinePostgreSQLPlatform::class],
41  'sqlite' => [DoctrineSQLitePlatform::class],
42  ];
43  }
44 
48  #[DataProvider('platformDataProvider')]
49  #[Test]
50  public function ‪maxBindParameters(string $platform): void
51  {
52  $platformMock = $this->createMock($platform);
53  self::assertGreaterThanOrEqual(1, ‪PlatformInformation::getMaxBindParameters($platformMock));
54  }
55 
59  #[DataProvider('platformDataProvider')]
60  #[Test]
61  public function ‪maxIdentifierLength(string $platform): void
62  {
63  $platformMock = $this->createMock($platform);
64  self::assertGreaterThanOrEqual(1, ‪PlatformInformation::getMaxIdentifierLength($platformMock));
65  }
66 
67  #[Test]
69  {
70  $this->expectException(\RuntimeException::class);
71  $this->expectExceptionCode(1500958070);
72  $platformMock = $this->createMock(DoctrineAbstractPlatform::class);
73  self::assertGreaterThanOrEqual(1, ‪PlatformInformation::getMaxBindParameters($platformMock));
74  }
75 
76  #[Test]
78  {
79  $this->expectException(\RuntimeException::class);
80  $this->expectExceptionCode(1500958070);
81  $platformMock = $this->createMock(DoctrineAbstractPlatform::class);
82  self::assertGreaterThanOrEqual(1, ‪PlatformInformation::getMaxIdentifierLength($platformMock));
83  }
84 }
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform\PlatformInformationTest\maxBindParametersWithUnknownPlatform
‪maxBindParametersWithUnknownPlatform()
Definition: PlatformInformationTest.php:68
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation\getMaxBindParameters
‪static getMaxBindParameters(DoctrineAbstractPlatform $platform)
Definition: PlatformInformation.php:106
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform\PlatformInformationTest\maxIdentifierLength
‪maxIdentifierLength(string $platform)
Definition: PlatformInformationTest.php:61
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform\PlatformInformationTest\maxBindParameters
‪static maxBindParameters(string $platform)
Definition: PlatformInformationTest.php:50
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform
Definition: PlatformHelperTest.php:18
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation\getMaxIdentifierLength
‪static getMaxIdentifierLength(DoctrineAbstractPlatform $platform)
Definition: PlatformInformation.php:95
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform\PlatformInformationTest
Definition: PlatformInformationTest.php:31
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform\PlatformInformationTest\maxIdentifierLengthWithUnknownPlatform
‪maxIdentifierLengthWithUnknownPlatform()
Definition: PlatformInformationTest.php:77
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation
Definition: PlatformInformation.php:33