Skip to content

Commit 2fdfe7b

Browse files
committed
chore: relocated symfony testing doc
1 parent adae1bb commit 2fdfe7b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

core/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ If you are starting a new project, the easiest way to get API Platform up is to
1414

1515
It comes with the API Platform core library integrated with [the Symfony framework](https://symfony.com), [the schema generator](../schema-generator/),
1616
[Doctrine ORM](https://www.doctrine-project.org),
17-
[NelmioCorsBundle](https://github.com/nelmio/NelmioCorsBundle) and [test assertions dedicated to APIs](testing.md).
17+
[NelmioCorsBundle](https://github.com/nelmio/NelmioCorsBundle) and [test assertions dedicated to APIs](../symfony/testing-utilities.md).
1818

1919
[MongoDB](mongodb.md) and [Elasticsearch](elasticsearch.md) can also be easily enabled.
2020

core/json-schema.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ docker compose exec php \
2525

2626
In a unit testing context, API Platform does not use the same schema version as the schema used when generating the API documentation. The version used by the documentation is the OpenAPI Schema version and the version used by unit testing is the JSON Schema version.
2727

28-
When [Testing the API](testing.md), JSON Schemas are useful to generate and automate unit testing. API Platform provides specific unit testing functionalities like [`assertMatchesResourceCollectionJsonSchema()`](testing.md#writing-functional-tests) or [`assertMatchesResourceItemJsonSchema()`](testing.md#writing-functional-tests) methods.
28+
When [Testing the API](../symfony/testing-utilities.md), JSON Schemas are useful to generate and automate unit testing. API Platform provides specific unit testing functionalities like [`assertMatchesResourceCollectionJsonSchema()`](../symfony/testing-utilities.md#writing-functional-tests) or [`assertMatchesResourceItemJsonSchema()`](../symfony/testing-utilities.md#writing-functional-tests) methods.
2929
These methods generate a JSON Schema then do unit testing based on the generated schema automatically.
3030

3131
Usually, the fact that API Platform uses a different schema version for unit testing is not a problem, but sometimes you may need to use the [`ApiProperty`](openapi.md#using-the-openapi-and-swagger-contexts) attribute to specify a [calculated field](serialization.md#calculated-field) type by overriding the OpenAPI Schema for the calculated field to be correctly documented.
3232

33-
When you will use [`assertMatchesResourceCollectionJsonSchema()`](testing.md#writing-functional-tests) or [`assertMatchesResourceItemJsonSchema()`](testing.md#writing-functional-tests) functions the unit test will fail on this [calculated field](serialization.md#calculated-field) as the unit testing process doesn't use the `openapi_context` you specified
33+
When you will use [`assertMatchesResourceCollectionJsonSchema()`](../symfony/testing-utilities.md#writing-functional-tests) or [`assertMatchesResourceItemJsonSchema()`](../symfony/testing-utilities.md#writing-functional-tests) functions the unit test will fail on this [calculated field](serialization.md#calculated-field) as the unit testing process doesn't use the `openapi_context` you specified
3434
because API Platform is using the JSON Schema version instead at this moment.
3535

3636
So there is a way to override JSON Schema specification for a specific property in the JSON Schema used by the unit testing process.
@@ -84,4 +84,4 @@ To generate JSON Schemas programmatically, use the `api_platform.json_schema.sch
8484
## Testing
8585

8686
API Platform provides a PHPUnit assertion to test if a response is valid according to a given Schema: `assertMatchesJsonSchema()`.
87-
Refer to [the testing documentation](testing.md) for more details.
87+
Refer to [the testing documentation](../symfony/testing-utilities.md) for more details.

core/testing.md renamed to symfony/testing-utilities.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Testing Utilities
22

33
API Platform provides a set of useful utilities dedicated to API testing.
4-
For an overview of how to test an API Platform app, be sure to read [the testing cookbook first](../symfony/testing.md).
4+
For an overview of how to test an API Platform app, be sure to read [the testing cookbook first](testing.md).
55

6-
<p align="center" class="symfonycasts"><a href="https://symfonycasts.com/screencast/api-platform-security/api-tests?cid=apip"><img src="../symfony/images/symfonycasts-player.png" alt="Test and Assertions screencast"><br>Watch the API Tests & Assertions screencast</a></p>
6+
<p align="center" class="symfonycasts"><a href="https://symfonycasts.com/screencast/api-platform-security/api-tests?cid=apip"><img src="images/symfonycasts-player.png" alt="Test and Assertions screencast"><br>Watch the API Tests & Assertions screencast</a></p>
77

88
## The Test HttpClient
99

symfony/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ docker compose exec php \
352352
If everything is working properly, you should see `OK (5 tests, 17 assertions)`.
353353
Your REST API is now properly tested!
354354

355-
Check out the [testing documentation](../core/testing.md) to discover the full range of assertions and other features provided by API Platform's test utilities.
355+
Check out the [testing documentation](testing-utilities.md) to discover the full range of assertions and other features provided by API Platform's test utilities.
356356

357357
## Writing Unit Tests
358358

0 commit comments

Comments
 (0)