Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #3698

Merged
merged 3 commits into from Sep 1, 2020
Merged

Fix tests #3698

merged 3 commits into from Sep 1, 2020

Conversation

soyuka
Copy link
Member

@soyuka soyuka commented Aug 31, 2020

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tickets na
License MIT
Doc PR

Fixes the tests:

  1. With lowest dependencies there was an issue with the name converter not accepting string groups
  2. Legacy test suite was missing git ?
  3. Symfony 5 expects router generate with a reference type

@@ -200,6 +201,6 @@ private function getReferenceType(string $resourceClass, ?int $referenceType): ?
$referenceType = $metadata->getAttribute('url_generation_strategy');
}

return $referenceType;
return null === $referenceType ? UrlGeneratorInterface::ABS_PATH : $referenceType;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return null === $referenceType ? UrlGeneratorInterface::ABS_PATH : $referenceType;
return $referenceType ?? UrlGeneratorInterface::ABS_PATH;

@@ -78,6 +79,11 @@ private function fieldsToAttributes(?string $resourceClass, ?ResourceMetadata $r
$fields = $info->getFieldSelection(PHP_INT_MAX);
}

// On lowest symfony dependencies there's a bug in the name converter not accepting a string in the group ssee https://github.com/symfony/symfony/pull/34490
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// On lowest symfony dependencies there's a bug in the name converter not accepting a string in the group ssee https://github.com/symfony/symfony/pull/34490
// On lowest symfony dependencies there's a bug in the name converter not accepting a string in the group see https://github.com/symfony/symfony/pull/34490

I suggest to require symfony/serializer >=4.3.9 instead.

@@ -78,6 +79,11 @@ private function fieldsToAttributes(?string $resourceClass, ?ResourceMetadata $r
$fields = $info->getFieldSelection(PHP_INT_MAX);
}

// On lowest symfony dependencies there's a bug in the name converter not accepting a string in the group ssee https://github.com/symfony/symfony/pull/34490
if (isset($context[AbstractNormalizer::GROUPS]) && !\is_array($context[AbstractNormalizer::GROUPS])) {
$context[AbstractNormalizer::GROUPS] = [$context[AbstractNormalizer::GROUPS]];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be (array) $context[AbstractNormalizer::GROUPS] too.

@soyuka soyuka force-pushed the fix-tests branch 4 times, most recently from 3eb83e5 to e42ff50 Compare August 31, 2020 12:22
@soyuka soyuka merged commit 2c87089 into api-platform:master Sep 1, 2020
@soyuka soyuka deleted the fix-tests branch September 1, 2020 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants