Final Class Yiisoft\Yii\Testing\FunctionalTester
| Inheritance | Yiisoft\Yii\Testing\FunctionalTester |
|---|
Public Methods
Method Details
| public mixed __construct ( string|null $environment = null, boolean $debug = false, array $defaultMocks = ['Yiisoft\\Session\\SessionInterface' => 'Yiisoft\\Session\\NullSession'] ) | ||
| $environment | string|null | |
| $debug | boolean | |
| $defaultMocks | array | |
public function __construct(
private readonly ?string $environment = null,
private readonly bool $debug = false,
private readonly array $defaultMocks = [
'Yiisoft\Session\SessionInterface' => 'Yiisoft\Session\NullSession',
]
) {
}
| public void bootstrapApplication ( string|null $projectRootPath = null ) | ||
| $projectRootPath | string|null | |
public function bootstrapApplication(?string $projectRootPath = null): void
{
if ($this->application !== null) {
return;
}
if ($projectRootPath === null) {
$projectRootPath = dirname(__DIR__, 5);
}
$this->application = new TestApplicationRunner(
responseGrabber: new ResponseGrabber(),
rootPath: $projectRootPath,
debug: $this->debug,
checkEvents: false,
environment: $this->environment,
);
$this->application->addProviders([$this->getMockServiceProvider()]);
}
| public Yiisoft\Yii\Testing\ResponseAccessor doRequest ( string $method, string $url, array $queryParams = [], array $postParams = [], mixed $body = null, array $headers = [] ) | ||
| $method | string | |
| $url | string | |
| $queryParams | array | |
| $postParams | array | |
| $body | mixed | |
| $headers | array | |
public function doRequest(
string $method,
string $url,
array $queryParams = [],
array $postParams = [],
mixed $body = null,
array $headers = [],
): ResponseAccessor {
$this->ensureApplicationLoaded();
$this->application?->withRequest($method, $url, $queryParams, $postParams, $body, $headers);
$this->application?->run();
return $this->application?->responseGrabber?->getResponse() ?? throw new RuntimeException(
'Either $application or $response is null'
);
}
| public \Psr\Container\ContainerInterface getContainer ( ) |
public function getContainer(): ContainerInterface
{
$this->ensureApplicationLoaded();
$this->application?->preloadContainer();
return $this->application->container ?? throw new Exception('Container was not set.');
}
Signup or Login in order to comment.