Feature #78358
closedAllow other HTTP verbs than GET in functional test
0%
Description
Using the functional test framework, one can test frontend requests using the GET method. In order to prepare for full API requests, we need to allow and test other methods as well, like POST, PUT and DELETE. Those requests can even transfer payload.
Updated by Anja Leichsenring about 8 years ago
As a testing playground, I created a class extending typo3/sysext/core/Classes/Tests/FunctionalTestCase.php
with a new function
protected function getFrontendResponseForTypenum(int $typeNum, string $apiRoute = '', string $requestMethod = 'GET', array $inputData = []): Response { $additionalParameter = ''; if (!empty($apiRoute)) { $additionalParameter .= '&api=' . $apiRoute; } $arguments = array( 'documentRoot' => $this->instancePath, 'requestUrl' => 'http://localhost/?type=' . $typeNum . $additionalParameter, 'requestMethod' => $requestMethod, 'inputData' => json_encode($inputData), ); ... same as in getFrontendResponse() ... return $response; }
This serves my personal testing use case, but might serve as example what I do as well. This method is more or less copied from getFrontendResponse()
With this class I am able to send PUT and DELETE requests to my testing classes.
Updated by Gerrit Code Review about 8 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50290
Updated by Gerrit Code Review about 8 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50290
Updated by Gerrit Code Review about 8 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50290
Updated by Gerrit Code Review about 8 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50290
Updated by Gerrit Code Review about 8 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50290
Updated by Riccardo De Contardi over 7 years ago
- Target version changed from 8 LTS to 9.0
Updated by Anja Leichsenring over 7 years ago
- Status changed from Under Review to Rejected
testing framework is no longer part of the core