Skip to content

Commit

Permalink
fix references & test
Browse files Browse the repository at this point in the history
  • Loading branch information
laryjulien committed Nov 10, 2021
1 parent 48f0034 commit db761b0
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/Core/Bridge/Symfony/Bundle/Resources/config/api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,18 +262,18 @@

<!-- Action -->

<service id="api_platform.action.placeholder" class="ApiPlatform\Core\Action\PlaceholderAction" public="true" />
<service id="api_platform.action.placeholder" class="ApiPlatform\Action\PlaceholderAction" public="true" />
<service id="api_platform.action.get_collection" alias="api_platform.action.placeholder" public="true" />
<service id="api_platform.action.post_collection" alias="api_platform.action.placeholder" public="true" />
<service id="api_platform.action.get_item" alias="api_platform.action.placeholder" public="true" />
<service id="api_platform.action.patch_item" alias="api_platform.action.placeholder" public="true" />
<service id="api_platform.action.put_item" alias="api_platform.action.placeholder" public="true" />
<service id="api_platform.action.delete_item" alias="api_platform.action.placeholder" public="true" />
<service id="api_platform.action.get_subresource" alias="api_platform.action.placeholder" public="true" />
<service id="api_platform.action.not_found" class="ApiPlatform\Core\Action\NotFoundAction" public="true" />
<service id="ApiPlatform\Core\Action\NotFoundAction" alias="api_platform.action.not_found" public="true" />
<service id="api_platform.action.not_found" class="ApiPlatform\Action\NotFoundAction" public="true" />
<service id="ApiPlatform\Action\NotFoundAction" alias="api_platform.action.not_found" public="true" />

<service id="api_platform.action.entrypoint" class="ApiPlatform\Core\Action\EntrypointAction" public="true">
<service id="api_platform.action.entrypoint" class="ApiPlatform\Action\EntrypointAction" public="true">
<argument type="service" id="api_platform.metadata.resource.name_collection_factory" />
</service>

Expand All @@ -287,7 +287,7 @@
<argument type="service" id="api_platform.openapi.factory.next" on-invalid="null"></argument>
</service>

<service id="api_platform.action.exception" class="ApiPlatform\Core\Action\ExceptionAction" public="true">
<service id="api_platform.action.exception" class="ApiPlatform\Action\ExceptionAction" public="true">
<argument type="service" id="api_platform.serializer" />
<argument>%api_platform.error_formats%</argument>
<argument>%api_platform.exception_to_status%</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<argument type="service" id="validator" />
<argument type="service" id="service_container" />
</service>
<service id="ApiPlatform\Validator\ValidatorInterface" alias="api_platform.validator" />
<service id="ApiPlatform\Symfony\EventListener\ValidatorInterface" alias="api_platform.validator" />

<service id="api_platform.metadata.property.metadata_factory.validator" class="ApiPlatform\Core\Bridge\Symfony\Validator\Metadata\Property\ValidatorPropertyMetadataFactory" decorates="api_platform.metadata.property.metadata_factory" decoration-priority="20" public="false">
<argument type="service" id="validator" />
Expand Down
2 changes: 1 addition & 1 deletion src/deprecation.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
// Action
ApiPlatform\Core\Action\EntrypointAction::class => ApiPlatform\Action\EntrypointAction::class,
ApiPlatform\Core\Action\ExceptionAction::class => ApiPlatform\Action\ExceptionAction::class,
ApiPlatform\Core\Action\NotfoundAction::class => ApiPlatform\Action\NotFoundAction::class,
ApiPlatform\Core\Action\NotFoundAction::class => ApiPlatform\Action\NotFoundAction::class,
ApiPlatform\Core\Action\PlaceholderAction::class => ApiPlatform\Action\PlaceholderAction::class,

// Bridge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,9 @@ private function getPartialContainerBuilderProphecy($configuration = null)
}

// Find missing aliases
// $containerBuilderProphecy->setAlias(Argument::type('string'), Argument::type(Alias::class))->will(function ($args) {
// echo "Alias: '{$args[0]}' => '{$args[1]}',".\PHP_EOL;
// });
$containerBuilderProphecy->setAlias(Argument::type('string'), Argument::type(Alias::class))->will(function ($args) {
echo "Alias: '{$args[0]}' => '{$args[1]}',".\PHP_EOL;
});

$containerBuilderProphecy->getParameter('kernel.project_dir')->willReturn(__DIR__.'/../../../../../Fixtures/app');
$containerBuilderProphecy->getParameter('kernel.debug')->willReturn(false);
Expand All @@ -1228,6 +1228,17 @@ private function getPartialContainerBuilderProphecy($configuration = null)
$containerBuilderProphecy->getAlias(Argument::type('string'))
->willReturn($this->prophesize(Alias::class)->reveal());

$deprecatedInterfaces = include __DIR__.'/../../../../../../src/deprecated_interfaces.php';
foreach ($deprecatedInterfaces as $oldInterface => $newInterface) {
$containerBuilderProphecy->hasAlias($oldInterface)->shouldBeCalled()->willReturn(false);
$containerBuilderProphecy->hasAlias($newInterface)->shouldBeCalled()->willReturn(true);
$containerBuilderProphecy->setAlias($oldInterface, $newInterface)->shouldBeCalled();

$definitionProphecy = $this->prophesize(Definition::class);
$definitionProphecy->setDeprecated('api-platform/core', '2.7', Argument::type('string'))->shouldBeCalled();
$containerBuilderProphecy->getDefinition($oldInterface)->shouldBeCalled()->willReturn($definitionProphecy->reveal());
}

return $containerBuilderProphecy;
}

Expand Down
12 changes: 8 additions & 4 deletions tests/Core/Bridge/Symfony/Bundle/Test/ApiTestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public function testAssertJsonContainsWithJsonObjectString(): void
{
"@context": "/contexts/Entrypoint"
}
JSON);
JSON
);
}

public function testAssertJsonContainsWithJsonScalarString(): void
Expand All @@ -64,7 +65,8 @@ public function testAssertJsonContainsWithJsonScalarString(): void
self::createClient()->request('GET', '/');
$this->assertJsonContains(<<<JSON
"/contexts/Entrypoint"
JSON);
JSON
);
}

public function testAssertJsonEquals(): void
Expand All @@ -90,7 +92,8 @@ public function testAssertJsonEqualsWithJsonObjectString(): void
"name": "Address/name"
}
}
JSON);
JSON
);
}

public function testAssertJsonEqualsWithJsonScalarString(): void
Expand All @@ -101,7 +104,8 @@ public function testAssertJsonEqualsWithJsonScalarString(): void
self::createClient()->request('GET', '/contexts/Address');
$this->assertJsonEquals(<<<JSON
"Address/name"
JSON);
JSON
);
}

public function testAssertMatchesJsonSchema(): void
Expand Down
3 changes: 2 additions & 1 deletion tests/Core/Bridge/Symfony/Bundle/Test/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ public function testComplexScenario(): void
"additionalProperties": true,
"required": ["@context", "@id", "@type", "hydra:member"]
}
JSON);
JSON
);
}

public function testStream(): void
Expand Down

0 comments on commit db761b0

Please sign in to comment.