forked from tienvx/composer-downloads-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from pact-foundation/test-remove-package
test: Test install then remove package
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace LastCall\DownloadsPlugin\Tests\Integration\Valid; | ||
|
||
use LastCall\DownloadsPlugin\Tests\Integration\CommandTestCase; | ||
|
||
class InstallThenRemovePackageTest extends CommandTestCase | ||
{ | ||
private bool $isRemoved; | ||
|
||
/** | ||
* @testWith [["install"]] | ||
* [["remove", "test/library"]] | ||
*/ | ||
public function testDownload(array $command): void | ||
{ | ||
$this->isRemoved = $command === ['remove', 'test/library']; | ||
$this->runComposerCommandAndAssert($command); | ||
} | ||
|
||
protected function getFilesFromLibrary(): array | ||
{ | ||
if ($this->isRemoved) { | ||
return array_fill_keys(array_keys(parent::getFilesFromLibrary()), false); | ||
} else { | ||
return parent::getFilesFromLibrary(); | ||
} | ||
} | ||
|
||
protected function getExecutableFilesFromLibrary(): array | ||
{ | ||
if ($this->isRemoved) { | ||
return []; | ||
} else { | ||
return parent::getExecutableFilesFromLibrary(); | ||
} | ||
} | ||
|
||
protected function getMissingExecutableFiles(): array | ||
{ | ||
if ($this->isRemoved) { | ||
return array_keys(parent::getExecutableFilesFromLibrary()); | ||
} else { | ||
return parent::getMissingExecutableFiles(); | ||
} | ||
} | ||
} |