AppTesting class

Framework\Testing\AppTesting

Class AppTesting.

Defined in libraries/testing/src/AppTesting.php

Properties #

$app
-

$app

protected \Framework\MVC\App $app

Methods #

__construct()
AppTesting constructor.
runCli()
Simulate a CLI request for tests.
runHttp()
Simulate an HTTP Request for tests.
suppressOutputBuffer()
Run App in a Closure suppressing the output buffer.

__construct()

public function __construct(\Framework\Config\Config $config)

AppTesting constructor.

Parameters
  • \Framework\Config\Config $config

runCli()

public function runCli(string $command, array $env = array ( )): void

Simulate a CLI request for tests.

Parameters
  • string $command - Command line
  • array $env - Environment variables
Returns void

runHttp()

public function runHttp(\Framework\HTTP\URL|string $url, string $method = 'GET', array $headers = array ( ), string $body = ''): void

Simulate an HTTP Request for tests.

Parameters
  • \Framework\HTTP\URL|string $url
  • string $method
  • array $headers
  • string $body
Returns void

suppressOutputBuffer()

protected function suppressOutputBuffer(Closure $closure): void

Run App in a Closure suppressing the output buffer.

It avoids buffer to be output in the PHPUnit terminal.

Parameters
  • Closure $closure
Returns void