So we have currently end to end tests using real http client which are really slow. I wanted to switch them to use laminas/laminas-test but we test cases making many requests in one test, and it doesn’t seem to be working. If I do two requests to the same endpoint it doesn’t do anything, It just returns the same response and controller is never executed.
Is there a way to do that without init of new application?
Hello and welcome to our forums!
Many requests in on test seems like a lot to verify an assertion.
setUp and the
tearDown method and you will find
reset. But you should recheck your tests because many requests in one test sounds wrong.
Hi there! I know there is reset method - but it resets the whole application just to null, this doesn’t seem to be solution - because each time the application will be bootstrapped again. I was wondering if there is some more optimized way to do it.
Well we have tons of tests like this already - legacy code so can’t really change them.
No, this does not exist, as it does not correspond to the concept. Create your own
reset method and check if it works without destroying the application. But this can lead to side effects!
It’s not an argument, because if you don’t change it now, you’re just shifting the problem!
Well it is argument because we have hunders if not thousands of those tests, so changing them will require a tremendous job to do that.
Also those tests are kind of end to end implemented that way - they check whole scenarios, so they need to really call some endpoint multiple times in one test case.
Yea I was trying to do that already - like create my own reset method but it wasn’t actually working correctly, controller was not executed. This is kind of sad because in all other frameworks it works without any issue.
Please help to improve this! Create an issue report or a pull request with your findings.
But i don’t think this is actually a tests issue, most likely just Laminas\Mvc\Application issue.