mirror of
https://github.com/yiisoft/app.git
synced 2026-03-07 00:26:50 +01:00
55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\Support;
|
|
|
|
use App\Environment;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
use Yiisoft\Yii\Runner\Http\HttpApplicationRunner;
|
|
|
|
use function dirname;
|
|
|
|
/**
|
|
* Inherited Methods
|
|
*
|
|
* @method void wantToTest($text)
|
|
* @method void wantTo($text)
|
|
* @method void execute($callable)
|
|
* @method void expectTo($prediction)
|
|
* @method void expect($prediction)
|
|
* @method void amGoingTo($argumentation)
|
|
* @method void am($role)
|
|
* @method void lookForwardTo($achieveValue)
|
|
* @method void comment($description)
|
|
* @method void pause($vars = [])
|
|
*
|
|
* @SuppressWarnings(PHPMD)
|
|
*/
|
|
class FunctionalTester extends \Codeception\Actor
|
|
{
|
|
use _generated\FunctionalTesterActions;
|
|
|
|
/**
|
|
* Define custom actions here
|
|
*/
|
|
|
|
public function sendRequest(ServerRequestInterface $request): ResponseInterface
|
|
{
|
|
$runner = new HttpApplicationRunner(
|
|
rootPath: dirname(__DIR__, 2),
|
|
environment: Environment::appEnv(),
|
|
);
|
|
|
|
$response = $runner->runAndGetResponse($request);
|
|
|
|
$body = $response->getBody();
|
|
if ($body->isSeekable()) {
|
|
$body->rewind();
|
|
}
|
|
|
|
return $response;
|
|
}
|
|
}
|