From cf195f24f11c6265ee79bf8998c506cecadfc22e Mon Sep 17 00:00:00 2001 From: Carlo Beltrame Date: Wed, 19 May 2021 16:20:03 +0200 Subject: [PATCH 1/2] Add notice about disableReboot in tests with multiple requests See https://github.com/api-platform/api-platform/issues/1668 This notice can be removed again once that issue is resolved. --- distribution/testing.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/distribution/testing.md b/distribution/testing.md index 7bd161f3df7..c78f4aca83e 100644 --- a/distribution/testing.md +++ b/distribution/testing.md @@ -228,6 +228,8 @@ from [AliceBundle](https://github.com/hautelook/AliceBundle/blob/master/README.m test, purge the database, load fixtures, begin a transaction, and, at the end of each test, roll back the transaction previously begun. Because of this, you can run your tests without worrying about fixtures. +There is one caveat though: In some tests, it is necessary to perform multiple requests in one test, for example when creating a user via the API and checking that a subsequent login using the same password works. However, the client will by default reboot the kernel, which will reset the database. You can prevent this by adding `$client->disableReboot();` to such tests. + All you have to do now is to run your tests: ```console From 0b9d2134718c9d214e228a856c53d3b7140d6db0 Mon Sep 17 00:00:00 2001 From: Carlo Beltrame Date: Wed, 19 May 2021 16:25:49 +0200 Subject: [PATCH 2/2] Fix typo Co-authored-by: Alan Poulain --- distribution/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/testing.md b/distribution/testing.md index c78f4aca83e..4032b425268 100644 --- a/distribution/testing.md +++ b/distribution/testing.md @@ -228,7 +228,7 @@ from [AliceBundle](https://github.com/hautelook/AliceBundle/blob/master/README.m test, purge the database, load fixtures, begin a transaction, and, at the end of each test, roll back the transaction previously begun. Because of this, you can run your tests without worrying about fixtures. -There is one caveat though: In some tests, it is necessary to perform multiple requests in one test, for example when creating a user via the API and checking that a subsequent login using the same password works. However, the client will by default reboot the kernel, which will reset the database. You can prevent this by adding `$client->disableReboot();` to such tests. +There is one caveat though: in some tests, it is necessary to perform multiple requests in one test, for example when creating a user via the API and checking that a subsequent login using the same password works. However, the client will by default reboot the kernel, which will reset the database. You can prevent this by adding `$client->disableReboot();` to such tests. All you have to do now is to run your tests: