Skip to content

Commit

Permalink
Create StraussIssue109Test.php
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHenryIE committed Jun 10, 2024
1 parent 8f274ad commit 7593385
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/Issues/StraussIssue109Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/**
* Defined CLI arguments are breaking the extra.strauss config even when they are not present.
*
* @see https://github.com/BrianHenryIE/strauss/pull/109
*/

namespace BrianHenryIE\Strauss\Tests\Issues;

use BrianHenryIE\Strauss\Tests\Integration\Util\IntegrationTestCase;

/**
* @package BrianHenryIE\Strauss\Tests\Issues
* @coversNothing
*/
class StraussIssue109Test extends IntegrationTestCase
{
public function test_absent_cli_argument_parsing_does_not_overwrite_config()
{
$composerJsonString = <<<'EOD'
{
"name": "strauss/issue104",
"require": {
"psr/log": "1.0.0"
},
"extra": {
"strauss": {
"namespace_prefix": "Strauss\\Issue109\\",
"delete_vendor_packages": true
}
}
}
EOD;

chdir($this->testsWorkingDir);

file_put_contents($this->testsWorkingDir . '/composer.json', $composerJsonString);

exec('composer install');

$_SERVER['argv'] = [$this->projectDir . '/bin/strauss'];

$version = '0.19.1';
$app = new \BrianHenryIE\Strauss\Console\Application($version);
$app->setAutoExit(false);
$result = $app->run();

$this->assertEquals(0, $result);

$this->assertFileDoesNotExist($this->testsWorkingDir . 'vendor/psr/log/composer.json');
}
}

0 comments on commit 7593385

Please sign in to comment.