‪TYPO3CMS  11.5
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;
21 use Doctrine\DBAL\Platforms\MySqlPlatform;
22 use Doctrine\DBAL\Platforms\PostgreSQL94Platform as PostgreSqlPlatform;
23 use Doctrine\DBAL\Platforms\SqlitePlatform;
24 use Doctrine\DBAL\Platforms\SQLServer2012Platform as SQLServerPlatform;
25 use Prophecy\PhpUnit\ProphecyTrait;
27 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
28 
32 class ‪PlatformInformationTest extends UnitTestCase
33 {
34  use ProphecyTrait;
35 
41  public function ‪platformDataProvider(): array
42  {
43  return [
44  'mysql' => [$this->prophesize(MySqlPlatform::class)->reveal()],
45  'postgresql' => [$this->prophesize(PostgreSqlPlatform::class)->reveal()],
46  'sqlserver' => [$this->prophesize(SQLServerPlatform::class)->reveal()],
47  'sqlite' => [$this->prophesize(SqlitePlatform::class)->reveal()],
48  ];
49  }
50 
56  public function ‪maxBindParameters(AbstractPlatform $platform): void
57  {
58  self::assertGreaterThanOrEqual(1, ‪PlatformInformation::getMaxBindParameters($platform));
59  }
60 
64  public function ‪maxBindParametersWithUnknownPlatform(): void
65  {
66  $this->expectException(\RuntimeException::class);
67  $this->expectExceptionCode(1500958070);
68  $platform = $this->prophesize(AbstractPlatform::class)->reveal();
69  self::assertGreaterThanOrEqual(1, ‪PlatformInformation::getMaxBindParameters($platform));
70  }
71 
77  public function ‪maxIdentifierLength(AbstractPlatform $platform): void
78  {
79  self::assertGreaterThanOrEqual(1, ‪PlatformInformation::getMaxIdentifierLength($platform));
80  }
81 
85  public function ‪maxIdentifierLengthWithUnknownPlatform(): void
86  {
87  $this->expectException(\RuntimeException::class);
88  $this->expectExceptionCode(1500958070);
89  $platform = $this->prophesize(AbstractPlatform::class)->reveal();
90  self::assertGreaterThanOrEqual(1, ‪PlatformInformation::getMaxIdentifierLength($platform));
91  }
92 }
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform\PlatformInformationTest\maxBindParametersWithUnknownPlatform
‪maxBindParametersWithUnknownPlatform()
Definition: PlatformInformationTest.php:63
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform\PlatformInformationTest\maxIdentifierLength
‪maxIdentifierLength(AbstractPlatform $platform)
Definition: PlatformInformationTest.php:76
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform
Definition: PlatformInformationTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform\PlatformInformationTest\platformDataProvider
‪array platformDataProvider()
Definition: PlatformInformationTest.php:40
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation\getMaxBindParameters
‪static int getMaxBindParameters(AbstractPlatform $platform)
Definition: PlatformInformation.php:125
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform\PlatformInformationTest
Definition: PlatformInformationTest.php:33
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform\PlatformInformationTest\maxIdentifierLengthWithUnknownPlatform
‪maxIdentifierLengthWithUnknownPlatform()
Definition: PlatformInformationTest.php:84
‪TYPO3\CMS\Core\Tests\Unit\Database\Platform\PlatformInformationTest\maxBindParameters
‪maxBindParameters(AbstractPlatform $platform)
Definition: PlatformInformationTest.php:55
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation
Definition: PlatformInformation.php:33
‪TYPO3\CMS\Core\Database\Platform\PlatformInformation\getMaxIdentifierLength
‪static int getMaxIdentifierLength(AbstractPlatform $platform)
Definition: PlatformInformation.php:111