Skip to content

Commit

Permalink
Allow pass config group names to app constructor (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Jan 15, 2023
1 parent 19fa0dd commit 2bd5e49
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,8 @@
## 1.2.0 under development

- Enh #30: Adapt to `yiisoft/yii-runner` of version `^2.0` (@vjik)
- New #31: In the `ConsoleApplicationRunner` constructor make parameter "environment" optional (`null` by default) and
add new parameters that set config group names for container, bootstrap and events (@vjik)

## 1.1.1 November 10, 2022

Expand Down
18 changes: 14 additions & 4 deletions src/ConsoleApplicationRunner.php
Expand Up @@ -27,13 +27,23 @@ final class ConsoleApplicationRunner extends ApplicationRunner
/**
* @param string $rootPath The absolute path to the project root.
* @param bool $debug Whether the debug mode is enabled.
* @param string $containerConfigGroup The container configuration group name.
* @param string|null $bootstrapGroup The bootstrap configuration group name.
* @param string|null $eventsGroup The event configuration group name to check. The configuration of events is
* checked in debug mode only.
* @param string|null $environment The environment name.
*/
public function __construct(string $rootPath, bool $debug, ?string $environment)
{
public function __construct(
string $rootPath,
bool $debug,
string $containerConfigGroup = 'console',
?string $bootstrapGroup = 'bootstrap-console',
?string $eventsGroup = 'events-console',
?string $environment = null,
) {
parent::__construct($rootPath, $debug, 'console', $environment);
$this->bootstrapGroup = 'bootstrap-console';
$this->eventsGroup = 'events-console';
$this->bootstrapGroup = $bootstrapGroup;
$this->eventsGroup = $eventsGroup;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Cli/Support/Failure/run
Expand Up @@ -7,5 +7,5 @@ use Yiisoft\Yii\Runner\Console\ConsoleApplicationRunner;

require_once dirname(__DIR__, 4) . '/vendor/autoload.php';

$runner = new ConsoleApplicationRunner(__DIR__, true, null);
$runner = new ConsoleApplicationRunner(__DIR__, true);
$runner->run();
2 changes: 1 addition & 1 deletion tests/Cli/Support/Success/run
Expand Up @@ -7,5 +7,5 @@ use Yiisoft\Yii\Runner\Console\ConsoleApplicationRunner;

require_once dirname(__DIR__, 4) . '/vendor/autoload.php';

$runner = new ConsoleApplicationRunner(__DIR__, true, null);
$runner = new ConsoleApplicationRunner(__DIR__, true);
$runner->run();

0 comments on commit 2bd5e49

Please sign in to comment.