Skip to content
Snippets Groups Projects
Commit 91e7b274 authored by Stefan Bürk's avatar Stefan Bürk
Browse files

[TASK] Build response in tests using factories

Some tests created response objects the wrong way
by hand. This change now uses the known factories
to build them correctly.

Resolves: #100487
Related: #100249
Releases: main
Change-Id: Ic3de0e237fe0d9db9900b78ea88459e850c7bdbf
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78494


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
parent d92756aa
Branches
Tags
No related merge requests found
......@@ -19,8 +19,9 @@ use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Http\Message\RequestInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Http\RedirectResponse;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Core\Http\ResponseFactory;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Http\StreamFactory;
use TYPO3\CMS\Core\Http\Uri;
use TYPO3\CMS\Redirects\Event\RedirectWasHitEvent;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
......@@ -90,7 +91,8 @@ class WebhookExecutionTest extends FunctionalTestCase
$GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler']['logger'] = function () use ($inspector) {
return function (RequestInterface $request) use ($inspector) {
$inspector($request);
return new Response('success', 200);
return (new ResponseFactory())->createResponse()
->withBody((new StreamFactory())->createStream('success'));
};
};
}
......
......@@ -24,8 +24,9 @@ use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\SecurityAspect;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Core\Http\ResponseFactory;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Http\StreamFactory;
use TYPO3\CMS\Core\Security\RequestToken;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService;
......@@ -80,7 +81,8 @@ final class WebhookExecutionTest extends FunctionalTestCase
$GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler']['logger'] = function () use ($inspector) {
return function (RequestInterface $request) use ($inspector) {
$inspector($request);
return new Response('success', 200);
return (new ResponseFactory())->createResponse()
->withBody((new StreamFactory())->createStream('success'));
};
};
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment