Skip to content

Commit d6cd2d3

Browse files
committed
Fixed type issues from dataProviderTestThatManyToManyAssociationMethodsWorksAsExpected method
1 parent 7c0ae4e commit d6cd2d3

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

tests/Integration/TestCase/EntityTestCase.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -522,27 +522,24 @@ public static function dataProviderTestThatManyToManyAssociationMethodsWorksAsEx
522522
// Get entity class meta data
523523
$meta = $entityManager->getClassMetadata(static::$entityName);
524524

525-
$iterator = static function (array $mapping): array {
526-
$class = $mapping['targetEntity'];
525+
$iterator = static function (AssociationMapping $mapping): array {
526+
$class = $mapping->targetEntity;
527527

528-
self::assertIsString($class);
529528
self::assertTrue(class_exists($class));
530529

531530
$targetEntity = new $class();
532531

533-
$singular = $mapping['fieldName'][mb_strlen((string)$mapping['fieldName']) - 1] === 's'
534-
? mb_substr((string)$mapping['fieldName'], 0, -1)
535-
: $mapping['fieldName'];
536-
537-
self::assertIsString($singular);
532+
$singular = mb_substr($mapping->fieldName, -1) === 's'
533+
? mb_substr($mapping->fieldName, 0, -1)
534+
: $mapping->fieldName;
538535

539536
return [
540537
[
541-
'get' . ucfirst((string)$mapping['fieldName']),
538+
'get' . ucfirst($mapping->fieldName),
542539
'add' . ucfirst($singular),
543540
'remove' . ucfirst($singular),
544-
'clear' . ucfirst((string)$mapping['fieldName']),
545-
$mapping['fieldName'],
541+
'clear' . ucfirst($mapping->fieldName),
542+
$mapping->fieldName,
546543
$targetEntity,
547544
$mapping,
548545
],
@@ -555,7 +552,7 @@ public static function dataProviderTestThatManyToManyAssociationMethodsWorksAsEx
555552

556553
$items = array_filter(
557554
$meta->getAssociationMappings(),
558-
static fn ($mapping): bool => $mapping['type'] === ClassMetadata::MANY_TO_MANY
555+
static fn (AssociationMapping $mapping): bool => $mapping->type() === ClassMetadata::MANY_TO_MANY
559556
);
560557

561558
if (empty($items)) {

0 commit comments

Comments
 (0)