-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
respect to platform restrictions when creating an identfier name for …
…oracle
- Loading branch information
1 parent
9daede4
commit e48d65d
Showing
2 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/Doctrine/Tests/DBAL/Functional/Platform/PlatformRestrictionsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\DBAL\Functional\Platform; | ||
|
||
use Doctrine\DBAL\Schema\Table; | ||
use Doctrine\Tests\DbalFunctionalTestCase; | ||
use function str_repeat; | ||
|
||
/** | ||
* This class holds tests that make sure generated SQL statements respect to platform restrictions | ||
* like maximum element name length | ||
*/ | ||
class PlatformRestrictionsTest extends DbalFunctionalTestCase | ||
{ | ||
/** | ||
* Tests element names that are at the boundary of the identifier length limit. | ||
* Ensures generated auto-increment identifier name respects to platform restrictions. | ||
*/ | ||
public function testMaxIdentifierLengthLimitWithAutoIncrement() : void | ||
{ | ||
$platform = $this->connection->getDatabasePlatform(); | ||
$tableName = str_repeat('x', $platform->getMaxIdentifierLength()); | ||
$columnName = str_repeat('y', $platform->getMaxIdentifierLength()); | ||
$table = new Table($tableName); | ||
$table->addColumn($columnName, 'integer', ['autoincrement' => true]); | ||
$table->setPrimaryKey([$columnName]); | ||
$this->connection->getSchemaManager()->dropAndCreateTable($table); | ||
$createdTable = $this->connection->getSchemaManager()->listTableDetails($tableName); | ||
|
||
$this->assertTrue($createdTable->hasColumn($columnName)); | ||
$this->assertTrue($createdTable->hasPrimaryKey()); | ||
} | ||
} |