Project

General

Profile

Actions

Feature #78358

closed

Allow other HTTP verbs than GET in functional test

Added by Anja Leichsenring over 7 years ago. Updated about 7 years ago.

Status:
Rejected
Priority:
Should have
Category:
Tests
Target version:
Start date:
2016-10-20
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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.

Actions #1

Updated by Anja Leichsenring over 7 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.

Actions #2

Updated by Gerrit Code Review over 7 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

Actions #3

Updated by Gerrit Code Review over 7 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

Actions #4

Updated by Gerrit Code Review over 7 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

Actions #5

Updated by Gerrit Code Review over 7 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

Actions #6

Updated by Gerrit Code Review over 7 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

Actions #7

Updated by Anja Leichsenring over 7 years ago

  • Description updated (diff)
Actions #8

Updated by Riccardo De Contardi about 7 years ago

  • Target version changed from 8 LTS to 9.0
Actions #9

Updated by Anja Leichsenring about 7 years ago

  • Status changed from Under Review to Rejected

testing framework is no longer part of the core

Actions

Also available in: Atom PDF