Skip to content

Commit

Permalink
Address DBAL deprecation
Browse files Browse the repository at this point in the history
listTableDetails() has been deprecated in favor of getTable().
  • Loading branch information
greg0ire committed Aug 27, 2022
1 parent 120725e commit 06fe565
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/GH6823Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use Doctrine\ORM\Mapping\Table;
use Doctrine\Tests\OrmFunctionalTestCase;

use function method_exists;

class GH6823Test extends OrmFunctionalTestCase
{
public function testCharsetCollationWhenCreatingForeignRelations(): void
Expand All @@ -31,27 +33,28 @@ public function testCharsetCollationWhenCreatingForeignRelations(): void
);

$schemaManager = $this->createSchemaManager();
$method = method_exists($schemaManager, 'getTable') ? 'getTable' : 'listTableDetails';
/* gh6823_user.group_id should use charset ascii and collation
* ascii_general_ci, because that is what gh6823_group.id falls back to */
$userGroupIdOptions = $schemaManager->listTableDetails('gh6823_user')->getColumn('group_id')->toArray();
$userGroupIdOptions = $schemaManager->$method('gh6823_user')->getColumn('group_id')->toArray();
self::assertSame('ascii', $userGroupIdOptions['charset']);
self::assertSame('ascii_general_ci', $userGroupIdOptions['collation']);

/* gh6823_user.status_id should use charset latin1 and collation
* latin1_bin, because that is what gh6823_status.id uses */
$userStatusIdOptions = $schemaManager->listTableDetails('gh6823_user')->getColumn('status_id')->toArray();
$userStatusIdOptions = $schemaManager->$method('gh6823_user')->getColumn('status_id')->toArray();
self::assertSame('latin1', $userStatusIdOptions['charset']);
self::assertSame('latin1_bin', $userStatusIdOptions['collation']);

/* gh6823_user_tags.user_id should use charset utf8mb4 and collation
* utf8mb4_bin, because that is what gh6823_user.id falls back to */
$userTagsUserIdOptions = $schemaManager->listTableDetails('gh6823_user_tags')->getColumn('user_id')->toArray();
$userTagsUserIdOptions = $schemaManager->$method('gh6823_user_tags')->getColumn('user_id')->toArray();
self::assertSame('utf8mb4', $userTagsUserIdOptions['charset']);
self::assertSame('utf8mb4_bin', $userTagsUserIdOptions['collation']);

/* gh6823_user_tags.tag_id should use charset latin1 and collation
* latin1_bin, because that is what gh6823_tag.id falls back to */
$userTagsTagIdOption = $schemaManager->listTableDetails('gh6823_user_tags')->getColumn('tag_id')->toArray();
$userTagsTagIdOption = $schemaManager->$method('gh6823_user_tags')->getColumn('tag_id')->toArray();
self::assertSame('latin1', $userTagsTagIdOption['charset']);
self::assertSame('latin1_bin', $userTagsTagIdOption['collation']);
}
Expand Down

0 comments on commit 06fe565

Please sign in to comment.