Toolkit

CodeReviewCommands extends AbstractCommands
in package

Command class for toolkit:code-review and toolkit:run-tests.

Table of Contents

Methods

getConfigurationFile()  : string
Path to YAML configuration file containing command defaults.
getJson()  : array<string|int, mixed>
Returns the JSON parsed content.
getWorkingDir()  : string
Returns the current working directory.
isWebsiteInstalled()  : bool
Check if the website is installed.
toolkitCodeReview()  : ResultData
Execute all or specific tools for static testing.
toolkitRunTests()  : ResultData
Execute all or specific tools for testing.
getBin()  : string
Validate and return the path to given bin.
getBinPath()  : string
Return the path to given bin.
getConfigValue()  : mixed|null
Return the configuration value.
getNodeBin()  : string
Validate and return the path to given bin from node packages.
getNodeBinPath()  : string
Return the path to given bin from node packages.
isJunit()  : bool
Check whether Junit option is being used, or env var is set.
isSimulating()  : bool
Check if current command is being executed with option simulate.
taskExecute()  : CollectionBuilder
Execute a command.
taskProcess()  : ReplaceBlock|CollectionBuilder
Process the file.
taskReplaceBlock()  : ReplaceBlock|CollectionBuilder
Replace block in a file.

Methods

getConfigurationFile()

Path to YAML configuration file containing command defaults.

public getConfigurationFile() : string
Return values
string

Configuration file path.

getJson()

Returns the JSON parsed content.

public getJson(string $filename[, bool $throwException = true ]) : array<string|int, mixed>
Parameters
$filename : string
$throwException : bool = true

If the file is not found.

Return values
array<string|int, mixed>

Json parsed content.

getWorkingDir()

Returns the current working directory.

public getWorkingDir() : string
Return values
string

The current working directory.

isWebsiteInstalled()

Check if the website is installed.

public isWebsiteInstalled() : bool
Return values
bool

toolkitCodeReview()

Execute all or specific tools for static testing.

public toolkitCodeReview(ConsoleIO $io[, array<string|int, mixed> $options = ['phpcs' => InputOption::VALUE_NONE, 'phpstan' => InputOption::VALUE_NONE, 'phpmd' => InputOption::VALUE_NONE, 'opts-review' => InputOption::VALUE_NONE, 'lint-php' => InputOption::VALUE_NONE, 'lint-yaml' => InputOption::VALUE_NONE, 'lint-js' => InputOption::VALUE_NONE, 'lint-css' => InputOption::VALUE_NONE, 'lint-cspell' => InputOption::VALUE_NONE, 'lint-behat' => InputOption::VALUE_NONE, 'complock-check' => InputOption::VALUE_NONE, 'requirements' => InputOption::VALUE_NONE] ]) : ResultData

If no option is given, all the tests will be executed.

Parameters
$io : ConsoleIO
$options : array<string|int, mixed> = ['phpcs' => InputOption::VALUE_NONE, 'phpstan' => InputOption::VALUE_NONE, 'phpmd' => InputOption::VALUE_NONE, 'opts-review' => InputOption::VALUE_NONE, 'lint-php' => InputOption::VALUE_NONE, 'lint-yaml' => InputOption::VALUE_NONE, 'lint-js' => InputOption::VALUE_NONE, 'lint-css' => InputOption::VALUE_NONE, 'lint-cspell' => InputOption::VALUE_NONE, 'lint-behat' => InputOption::VALUE_NONE, 'complock-check' => InputOption::VALUE_NONE, 'requirements' => InputOption::VALUE_NONE]

Command options.

Tags
command

toolkit:code-review

option

phpcs Execute the command toolkit:test-phpcs.

option

phpstan Execute the command toolkit:test-phpstan.

option

phpmd Execute the command toolkit:test-phpmd.

option

opts-review Execute the command toolkit:opts-review.

option

lint-php Execute the command toolkit:lint-php.

option

lint-yaml Execute the command toolkit:lint-yaml.

option

lint-js Execute the command toolkit:lint-js.

option

lint-css Execute the command toolkit:lint-css.

option

lint-cspell Execute the command toolkit:lint-cspell.

option

lint-behat Execute the command toolkit:lint-behat.

option

complock-check Execute the command toolkit:complock-check.

option

requirements Execute the command toolkit:requirements.

option

junit Whether to export results as junit.

SuppressWarnings

(PHPMD.CyclomaticComplexity)

SuppressWarnings

(PHPMD.NPathComplexity)

Return values
ResultData

The toolkit code-review command status.

toolkitRunTests()

Execute all or specific tools for testing.

public toolkitRunTests(ConsoleIO $io[, array<string|int, mixed> $options = ['phpunit' => InputOption::VALUE_NONE, 'behat' => InputOption::VALUE_NONE, 'blackfire' => InputOption::VALUE_NONE, 'components' => InputOption::VALUE_NONE] ]) : ResultData

If no option is given, all the tests will be executed.

Parameters
$io : ConsoleIO
$options : array<string|int, mixed> = ['phpunit' => InputOption::VALUE_NONE, 'behat' => InputOption::VALUE_NONE, 'blackfire' => InputOption::VALUE_NONE, 'components' => InputOption::VALUE_NONE]

Command options.

Tags
command

toolkit:run-tests

option

phpunit Execute the command toolkit:test-phpunit.

option

behat Execute the command toolkit:run-behat.

option

blackfire Execute the command toolkit:run-blackfire.

option

components Execute the command toolkit:component-check.

option

junit Whether to export results as junit.

SuppressWarnings

(PHPMD.CyclomaticComplexity)

SuppressWarnings

(PHPMD.NPathComplexity)

Return values
ResultData

The toolkit run-tests command status.

getBin()

Validate and return the path to given bin.

protected getBin(string $name) : string
Parameters
$name : string

The bin to look for.

Tags
throws
TaskException
Return values
string

The bin path.

getBinPath()

Return the path to given bin.

protected getBinPath(string $name) : string
Parameters
$name : string
Return values
string

The path to given binary.

getConfigValue()

Return the configuration value.

protected getConfigValue(string $key[, mixed|null $default = null ]) : mixed|null
Parameters
$key : string

The config item to look up.

$default : mixed|null = null

Default configuration value for the key item if neither has value nor exists.

Return values
mixed|null

The configuration value.

getNodeBin()

Validate and return the path to given bin from node packages.

protected getNodeBin(string $name) : string
Parameters
$name : string

The bin to look for.

Tags
throws
TaskException
Return values
string

The bin path.

getNodeBinPath()

Return the path to given bin from node packages.

protected getNodeBinPath(string $name) : string
Parameters
$name : string
Return values
string

The path to given binary.

isJunit()

Check whether Junit option is being used, or env var is set.

protected isJunit() : bool
Return values
bool

isSimulating()

Check if current command is being executed with option simulate.

protected isSimulating() : bool
Return values
bool

True if using --simulate, false otherwise.

taskExecute()

Execute a command.

protected taskExecute(array<string|int, string> $tasks) : CollectionBuilder
Parameters
$tasks : array<string|int, string>

An array with tasks to execute.

Return values
CollectionBuilder

The task executed.

taskProcess()

Process the file.

protected taskProcess(string $source[, string $destination = '' ]) : ReplaceBlock|CollectionBuilder
Parameters
$source : string

The source file to process.

$destination : string = ''

The destination file.

Return values
ReplaceBlock|CollectionBuilder

The file task processed.

taskReplaceBlock()

Replace block in a file.

protected taskReplaceBlock([string $filename = '' ]) : ReplaceBlock|CollectionBuilder
Parameters
$filename : string = ''

The file to process.

Return values
ReplaceBlock|CollectionBuilder

The file replaced.


        
On this page

Search results