-
-
Notifications
You must be signed in to change notification settings - Fork 0
TestsCommand
Facilitates the execution of the PHPUnit testing framework.
This class MUST NOT be overridden and SHALL configure testing parameters dynamically.
- Full name:
\FastForward\DevTools\Console\Command\TestsCommand - Parent class:
BaseCommand - This class is marked as final and can't be subclassed
- This class implements:
\FastForward\DevTools\Console\Command\LoggerAwareCommandInterface - This class is a Final class
| Constant | Visibility | Type | Value |
|---|---|---|---|
CONFIG |
public | string | 'phpunit.xml' |
public __construct(\FastForward\DevTools\PhpUnit\Coverage\CoverageSummaryLoaderInterface $coverageSummaryLoader, \FastForward\DevTools\Composer\Json\ComposerJsonInterface $composer, \FastForward\DevTools\Filesystem\FilesystemInterface $filesystem, \Symfony\Component\Config\FileLocatorInterface $fileLocator, \FastForward\DevTools\Process\ProcessBuilderInterface $processBuilder, \FastForward\DevTools\Process\ProcessQueueInterface $processQueue, \Psr\Log\LoggerInterface $logger): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$coverageSummaryLoader |
\FastForward\DevTools\PhpUnit\Coverage\CoverageSummaryLoaderInterface | the loader used for coverage-php summaries |
$composer |
\FastForward\DevTools\Composer\Json\ComposerJsonInterface | the composer.json reader for autoload information |
$filesystem |
\FastForward\DevTools\Filesystem\FilesystemInterface | the filesystem utility used for path resolution |
$fileLocator |
\Symfony\Component\Config\FileLocatorInterface | the file locator used to resolve PHPUnit configuration |
$processBuilder |
\FastForward\DevTools\Process\ProcessBuilderInterface | the builder used to assemble the PHPUnit process |
$processQueue |
\FastForward\DevTools\Process\ProcessQueueInterface | the queue used to execute PHPUnit |
$logger |
\Psr\Log\LoggerInterface | the output-aware logger |
Configures the testing command input constraints.
protected configure(): voidThe method MUST specify valid arguments for testing paths, caching directories, bootstrap scripts, and coverage instructions. It SHALL align with robust testing standards.
Triggers the PHPUnit engine based on resolved paths and settings.
protected execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output): intThe method MUST assemble the necessary commands to initiate PHPUnit securely. It SHOULD optionally construct advanced configuration arguments such as caching and coverage.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$input |
\Symfony\Component\Console\Input\InputInterface | the runtime instruction set from the CLI |
$output |
\Symfony\Component\Console\Output\OutputInterface | the console feedback relay |
Return Value:
the status integer describing the termination code
Adds the standard JSON output options to the current command.
protected addJsonOption(): staticDetermines whether JSON output was requested.
protected isJsonOutput(\Symfony\Component\Console\Input\InputInterface $input): boolThe pretty-json flag SHALL imply JSON output.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$input |
\Symfony\Component\Console\Input\InputInterface |
Determines whether pretty JSON output was requested.
protected isPrettyJsonOutput(\Symfony\Component\Console\Input\InputInterface $input): boolParameters:
| Parameter | Type | Description |
|---|---|---|
$input |
\Symfony\Component\Console\Input\InputInterface |
Adds the standard cache control option to the current command.
protected addCacheOption(string $description): staticParameters:
| Parameter | Type | Description |
|---|---|---|
$description |
string | the cache option description |
Adds the standard cache directory option to the current command.
protected addCacheDirOption(string $description, string $default): staticParameters:
| Parameter | Type | Description |
|---|---|---|
$description |
string | the cache directory option description |
$default |
string | the command-specific default cache directory |
Resolves whether cache writes SHOULD be enabled for the current invocation.
protected isCacheEnabled(\Symfony\Component\Console\Input\InputInterface $input, bool $default = true): boolParameters:
| Parameter | Type | Description |
|---|---|---|
$input |
\Symfony\Component\Console\Input\InputInterface | the current command input |
$default |
bool | the command-specific default cache behavior when the option is omitted |
Returns the explicit cache flag that SHOULD be forwarded to nested commands.
protected resolveCacheArgument(\Symfony\Component\Console\Input\InputInterface $input): ?stringParameters:
| Parameter | Type | Description |
|---|---|---|
$input |
\Symfony\Component\Console\Input\InputInterface | the current command input |
Resolves a nested cache directory for a child command.
protected resolveCacheDirArgument(\Symfony\Component\Console\Input\InputInterface $input, string $path = ''): ?stringParameters:
| Parameter | Type | Description |
|---|---|---|
$input |
\Symfony\Component\Console\Input\InputInterface | the current command input |
$path |
string | the child cache path relative to the current command cache root |