Skip to content

Commit

Permalink
Use TestFrameworkTypes::PHPUNIT where a default value needed
Browse files Browse the repository at this point in the history
  • Loading branch information
sanmai committed Mar 22, 2019
1 parent 940fd34 commit e3b8e83
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/Command/InfectionCommand.php
Expand Up @@ -362,10 +362,9 @@ private function runConfigurationCommand(Locator $locator): void
$locator->locateOneOf(InfectionConfig::POSSIBLE_CONFIG_FILE_NAMES);
} catch (\Exception $e) {
$configureCommand = $this->getApplication()->find('configure');
$config = $this->getContainer()->get('infection.config.initial');

$args = [
'--test-framework' => $this->input->getOption('test-framework') ?: $config->getTestFramework(),
'--test-framework' => $this->input->getOption('test-framework') ?: TestFrameworkTypes::PHPUNIT,
];

$newInput = new ArrayInput($args);
Expand Down
3 changes: 2 additions & 1 deletion src/Config/InfectionConfig.php
Expand Up @@ -35,6 +35,7 @@

namespace Infection\Config;

use Infection\TestFramework\TestFrameworkTypes;
use Symfony\Component\Filesystem\Filesystem;

/**
Expand Down Expand Up @@ -152,7 +153,7 @@ public function getBootstrap(): string

public function getTestFramework(): string
{
return $this->config->testFramework ?? 'phpunit';
return $this->config->testFramework ?? TestFrameworkTypes::PHPUNIT;
}

public function getInitialTestsPhpOptions(): string
Expand Down
9 changes: 1 addition & 8 deletions src/Console/InfectionContainer.php
Expand Up @@ -232,19 +232,12 @@ public function __construct(array $values = [])

public function buildDynamicDependencies(InputInterface $input): void
{
$infectionConfigMaker = function () use ($input): InfectionConfig {
$this['infection.config'] = function () use ($input): InfectionConfig {
$facade = new ConfigCreatorFacade($this['locator'], $this['filesystem']);

return $facade->createConfig($input->getOption('configuration'));
};

/*
* Configuration step needs a distinct instance of a configuration as it may be inexistent.
* Therefore we can avoid using this stale and invalid configuration later on.
*/
$this['infection.config.initial'] = $infectionConfigMaker;
$this['infection.config'] = $infectionConfigMaker;

$this['coverage.path'] = function () use ($input): string {
$existingCoveragePath = '';

Expand Down

0 comments on commit e3b8e83

Please sign in to comment.