docs: rewrite JsonRpcBundle docs, add SDK docs, move them under docs/api
en/docs/api/rest-bundle/developers/testing.md
new file +35
−0
Testing
How to run the bundle's own tests and how they are organised. Useful if you make changes to REST Bundle.
Running
composer install
vendor/bin/phpunit -c phpunit.xml.dist
vendor/bin/phpunit -c phpunit.xml.dist --filter ErrorResponseTest
composer test and make test run PHPUnit (since 1.2). In Docker (make up-d, container php_<PROJECT_NAME>):
docker exec php_rest vendor/bin/phpunit -c phpunit.xml.dist
cebe/php-openapi emits PHP 8.4 deprecation warnings about implicitly nullable parameters; this is expected.
Structure
| Directory | Type | What it checks |
|---|---|---|
tests/Unit |
no kernel | RestServiceMap route rules, RpcRestRouteLoader, RpcFromRest parameters and type casting, RestErrorNormalizer and REST exceptions, listeners, RestRouteImport, OpenAPI and Postman builders, RestBundleExtension, Package |
tests/Integration |
container services | RestRequestParser (groups, versions, HTTP methods, tokens), listener priorities |
tests/Functional |
HTTP through the kernel | routes and aliases of multiple imports, execution, versions, parameters, RFC 9457 errors, documents and translations, security, rpc.post_response, coexistence with another IApiRouteImport adapter |
tests/Fixtures |
RPC procedures, routes file, translations, a second adapter, an rpc.post_response recorder |
tests/TestKernel.php loads FrameworkBundle, SecurityBundle, JsonRpcBundle and this bundle. The kernel cache lives in <tmp>/ufo-rest-tests; a test sets TestKernel::$security before bootKernel() to get a container with a different security configuration. Functional tests extend FunctionalTestCase (send(), json()).
Notes
- If a test sees a stale container after a quick fixture change, delete
<tmp>/ufo-rest-tests. - Add a functional test for any change to routes, statuses, problem documents or documentation: this is the REST contract.