Skip to content

Commit

Permalink
Fix tests 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ottaviano committed Dec 11, 2024
1 parent 912970e commit eacc46b
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 35 deletions.
3 changes: 1 addition & 2 deletions config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
api_platform:
name_converter: serializer.name_converter.camel_case_to_snake_case
use_symfony_listeners: true
resource_class_directories:
- '%kernel.project_dir%/src/Entity'
enable_docs: false
enable_swagger_ui: false
enable_entrypoint: false
# allow_plain_identifiers: true
# metadata_backward_compatibility_layer: false
exception_to_status:
ApiPlatform\Validator\Exception\ValidationException: !php/const Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST
formats:
Expand Down
1 change: 0 additions & 1 deletion features/api/change_email.feature
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ Feature:
{
"message": "Validation Failed",
"status": "error",
"type": "@[email protected]()",
"violations": [
{
"message": "Ceci n'est pas une adresse email valide.",
Expand Down
10 changes: 0 additions & 10 deletions features/api/profile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ Feature:
{
"message": "Validation Failed",
"status": "error",
"type": "@string@",
"violations": [
{
"propertyPath": "gender",
Expand Down Expand Up @@ -262,7 +261,6 @@ Feature:
{
"message": "Validation Failed",
"status": "error",
"type": "@string@",
"violations": [
{
"propertyPath": "first_name",
Expand All @@ -285,7 +283,6 @@ Feature:
{
"message": "Validation Failed",
"status": "error",
"type": "@string@",
"violations": [
{
"propertyPath": "first_name",
Expand All @@ -312,7 +309,6 @@ Feature:
{
"message": "Validation Failed",
"status": "error",
"type": "@string@",
"violations": [
{
"propertyPath": "first_name",
Expand Down Expand Up @@ -412,7 +408,6 @@ Feature:
{
"message": "Validation Failed",
"status": "error",
"type": "@string@",
"violations": [
{
"propertyPath": "subscription_types",
Expand Down Expand Up @@ -463,7 +458,6 @@ Feature:
{
"message": "Validation Failed",
"status": "error",
"type": "@string@",
"violations": [
{
"propertyPath": "position",
Expand Down Expand Up @@ -515,7 +509,6 @@ Feature:
{
"message": "Validation Failed",
"status": "error",
"type": "@string@",
"violations": [
{
"propertyPath": "nationality",
Expand Down Expand Up @@ -576,7 +569,6 @@ Feature:
{
"message": "Validation Failed",
"status": "error",
"type": "@string@",
"violations": [
{
"propertyPath": "phone",
Expand Down Expand Up @@ -625,7 +617,6 @@ Feature:
{
"message": "Validation Failed",
"status": "error",
"type": "@string@",
"violations": [
{
"propertyPath": "facebook_page_url",
Expand Down Expand Up @@ -683,7 +674,6 @@ Feature:
{
"message": "Validation Failed",
"status": "error",
"type": "@string@",
"violations": [
{
"propertyPath": "email_address",
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Filter/AbstractScopeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function setSecurity(Security $security): void

protected function getAllowedOperationNames(string $resourceClass): array
{
return ['{uuid}_get', '{uuid}.{_format}_get', '_get_collection'];
return ['{uuid}_get', '{uuid}{._format}_get', '_get_collection'];
}

private function isValidOperation(?Operation $operation): bool
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Filter/ScopeVisibilityFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ protected function getAllowedOperationNames(string $resourceClass): array
return ['_api_/v3/jecoute/news/{uuid}_get', '_api_/v3/jecoute/news_get_collection'];
}

return ['{uuid}_get', '{uuid}.{_format}_get', '_get_collection'];
return ['{uuid}_get', '{uuid}{._format}_get', '_get_collection'];
}
}
2 changes: 1 addition & 1 deletion src/Api/Listener/AdherentListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function onPostWrite(ViewEvent $viewEvent): void

if (
!\in_array($request->getMethod(), [Request::METHOD_POST, Request::METHOD_PUT])
|| '_api_/adherents/{uuid}/elect_put' !== $request->attributes->get('_api_operation_name')
|| '_api_/v3/adherents/{uuid}/elect_put' !== $request->attributes->get('_api_operation_name')
) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Listener/PostEventInscriptionEditListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function onEventInscriptionChange(RequestEvent $requestEvent): void
{
$request = $requestEvent->getRequest();

if ('_api_/event_inscriptions/{uuid}.{_format}_put' !== $request->attributes->get('_api_operation_name')) {
if ('_api_/event_inscriptions/{uuid}{._format}_put' !== $request->attributes->get('_api_operation_name')) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Normalizer/CommitteeCandidacyDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ public function denormalize($data, string $class, ?string $format = null, array

public function supportsDenormalization($data, string $type, ?string $format = null, array $context = [])
{
return CommitteeCandidacy::class === $type && '_api_/committee_candidacies_post' === $context['operation_name'];
return CommitteeCandidacy::class === $type && '_api_/v3/committee_candidacies_post' === $context['operation_name'];
}
}
2 changes: 1 addition & 1 deletion src/Normalizer/CommitteeDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public function supportsDenormalization($data, string $type, ?string $format = n
{
return !isset($context[self::ALREADY_CALLED])
&& Committee::class === $type
&& \in_array($context['operation_name'] ?? null, ['_api_/committees.{_format}_post', '_api_/committees/{uuid}_put'], true);
&& \in_array($context['operation_name'] ?? null, ['_api_/v3/committees{._format}_post', '_api_/v3/committees/{uuid}_put'], true);
}
}
2 changes: 1 addition & 1 deletion src/Normalizer/DesignationDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public function supportsDenormalization($data, string $type, ?string $format = n
{
return !isset($context[self::ALREADY_CALLED])
&& is_a($type, Designation::class, true)
&& \in_array($context['operation_name'] ?? null, ['_api_/designations.{_format}_post', '_api_/designations/{uuid}_put'], true);
&& \in_array($context['operation_name'] ?? null, ['_api_/v3/designations{._format}_post', '_api_/v3/designations/{uuid}_put'], true);
}
}
2 changes: 1 addition & 1 deletion src/Normalizer/DocumentNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function supportsNormalization($data, $format = null, array $context = []
private function getUrl(Document $document): string
{
return $this->urlGenerator->generate(
'_api_/documents/{uuid}/file_get',
'_api_/v3/documents/{uuid}/file_get',
['uuid' => $document->getUuid()],
UrlGeneratorInterface::ABSOLUTE_URL
);
Expand Down
2 changes: 1 addition & 1 deletion src/Normalizer/ElectedMandateDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public function supportsDenormalization($data, string $type, ?string $format = n
{
return !isset($context[self::ALREADY_CALLED])
&& is_a($type, Mandate::class, true)
&& '_api_/elected_mandates_post' === ($context['operation_name'] ?? null);
&& '_api_/v3/elected_mandates_post' === ($context['operation_name'] ?? null);
}
}
2 changes: 1 addition & 1 deletion src/Normalizer/FormationNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private function getUrl(Formation $formation): string
$parameters['scope'] = $scope->getCode();
}

return $this->urlGenerator->generate('_api_/formations/{uuid}/file_get', $parameters, UrlGeneratorInterface::ABSOLUTE_URL);
return $this->urlGenerator->generate('_api_/v3/formations/{uuid}/file_get', $parameters, UrlGeneratorInterface::ABSOLUTE_URL);
}

private function getCurrentScope(): ?ScopeGeneratorInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Normalizer/GeneralMeetingReportNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private function getUrl(GeneralMeetingReport $generalMeetingReport): string
$parameters['scope'] = $scope->getCode();
}

return $this->urlGenerator->generate('_api_/general_meeting_reports/{uuid}/file_get', $parameters, UrlGeneratorInterface::ABSOLUTE_URL);
return $this->urlGenerator->generate('_api_/v3/general_meeting_reports/{uuid}/file_get', $parameters, UrlGeneratorInterface::ABSOLUTE_URL);
}

private function getCurrentScope(): ?ScopeGeneratorInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Normalizer/UpdateElectedMandateDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function supportsDenormalization($data, string $type, ?string $format = n
{
return !isset($context[self::ALREADY_CALLED])
&& is_a($type, Mandate::class, true)
&& '_api_/elected_mandates/{uuid}_put' === ($context['operation_name'] ?? null);
&& '_api_/v3/elected_mandates/{uuid}_put' === ($context['operation_name'] ?? null);
}

private function handleChanges(
Expand Down
4 changes: 2 additions & 2 deletions src/Procuration/Listener/CheckUpdatedStatusListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public function preDeserialize(RequestEvent $event): void
$operationName = $request->attributes->get('_api_operation_name');

if (!\in_array($operationName, [
'_api_/requests/{uuid}_patch',
'_api_/proxies/{uuid}_patch',
'_api_/v3/requests/{uuid}_patch',
'_api_/v3/proxies/{uuid}_patch',
], true)) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function preDeserialize(RequestEvent $event): void
$operationName = $request->attributes->get('_api_operation_name');

if (!\in_array($operationName, [
'_api_/request_slots/{uuid}_put',
'_api_/proxy_slots/{uuid}_put',
'_api_/v3/request_slots/{uuid}_put',
'_api_/v3/proxy_slots/{uuid}_put',
], true)) {
return;
}
Expand All @@ -55,8 +55,8 @@ public function preWrite(ViewEvent $event): void
$operationName = $request->attributes->get('_api_operation_name');

if (!\in_array($operationName, [
'_api_/request_slots/{uuid}_put',
'_api_/proxy_slots/{uuid}_put',
'_api_/v3/request_slots/{uuid}_put',
'_api_/v3/proxy_slots/{uuid}_put',
], true)) {
return;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Procuration/Listener/ProcurationStatusActionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public function preDeserialize(RequestEvent $event): void
$operationName = $request->attributes->get('_api_operation_name');

if (!\in_array($operationName, [
'_api_/requests/{uuid}_patch',
'_api_/proxies/{uuid}_patch',
'_api_/v3/requests/{uuid}_patch',
'_api_/v3/proxies/{uuid}_patch',
], true)) {
return;
}
Expand Down Expand Up @@ -66,8 +66,8 @@ public function preWrite(ViewEvent $event): void
$operationName = $request->attributes->get('_api_operation_name');

if (!\in_array($operationName, [
'_api_/requests/{uuid}_patch',
'_api_/proxies/{uuid}_patch',
'_api_/v3/requests/{uuid}_patch',
'_api_/v3/proxies/{uuid}_patch',
], true)) {
return;
}
Expand Down

0 comments on commit eacc46b

Please sign in to comment.