Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix references & test
Browse files Browse the repository at this point in the history
laryjulien committed Nov 10, 2021

Verified

This commit was signed with the committer’s verified signature.
laryjulien Julien Lary
1 parent 48f0034 commit f5929a5
Showing 8 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ parameters:
path: tests/Core/Identifier/Normalizer/IntegerDenormalizerTest.php
-
message: '#Call to method PHPUnit\\Framework\\Assert::assertSame\(\) with array\(.+\) and array\(.+\) will always evaluate to false\.#'
path: tests/Core/Util/SortTraitTest.php
path: tests/Util/SortTraitTest.php
# https://github.com/phpstan/phpstan-symfony/issues/76
-
message: '#Service "test" is not registered in the container\.#'
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
@@ -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>

@@ -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>
Original file line number Diff line number Diff line change
@@ -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" />
2 changes: 1 addition & 1 deletion src/deprecation.php
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1210,7 +1210,7 @@ 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;
// echo "Alias: '{$args[0]}' => '{$args[1]}',".\PHP_EOL;
// });

$containerBuilderProphecy->getParameter('kernel.project_dir')->willReturn(__DIR__.'/../../../../../Fixtures/app');
@@ -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;
}

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

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

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

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

public function testStream(): void
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ public function testToString()
$this->assertEquals(str_replace(\PHP_EOL, "\n", <<<TXT
message 1
foo: message 2
TXT), $e->__toString());
TXT
), $e->__toString());
}
}

0 comments on commit f5929a5

Please sign in to comment.