Skip to content

Commit

Permalink
add test for existingConfig option - #13
Browse files Browse the repository at this point in the history
  • Loading branch information
boedah committed Dec 11, 2018
1 parent a912a07 commit b121cba
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions tests/DrushStackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,50 @@ public function testSiteInstallCommand()
$this->assertEquals($expected, $command);
}

public function testExistingConfigDefaultsToTrue()
{
$command = $this->taskDrushStack()
->existingConfig()
->siteInstall('minimal')
->getCommand();
$expected = 'drush site-install minimal -y --existing-config';
$this->assertEquals($expected, $command);
}

/**
* @dataProvider existingConfigWithBooleanParamIsRespectedProvider
*
* @param mixed $existingConfigParam
* @param string $commandParam
*/
public function testExistingConfigWithBooleanParamIsRespected(
$existingConfigParam,
$commandParam = ' --existing-config'
) {
$command = $this->taskDrushStack()
->existingConfig($existingConfigParam)
->siteInstall('minimal')
->getCommand();
$expected = 'drush site-install minimal -y' . $commandParam;
$this->assertEquals($expected, $command);
}

public function existingConfigWithBooleanParamIsRespectedProvider()
{
return [
// trueish
'true' => [true],
'1' => [1],
'"1"' => ['1'],
// falsish
'false' => [false, ''],
'0' => [0, ''],
'"0"' => ['0', ''],
'null' => [null, ''],
'empty string' => ['', ''],
];
}

public function testSiteAliasIsFirstOption()
{
$command = $this->taskDrushStack()
Expand Down Expand Up @@ -142,17 +186,17 @@ public function testDrushVersion($composerDrushVersion, $expectedVersion = null)

/**
* Should return an array of arrays with the following values:
* 0: $composerDrushVersion (can be different e.g. for RC versions
* 0: $composerDrushVersion (can be different e.g. for RC versions)
* 1: $expectedVersion
*
* @return array
*/
public function drushVersionProvider()
{
return [
['8.1.15'],
['9.0.0-rc1', '9.0.0'],
['9.4.0'],
'8' => ['8.1.15'],
'9-rc1' => ['9.0.0-rc1', '9.0.0'],
'9' => ['9.4.0'],
];
}

Expand Down

0 comments on commit b121cba

Please sign in to comment.