Skip to content

Commit

Permalink
Merge pull request #16 from pact-foundation/test-remove-package
Browse files Browse the repository at this point in the history
test: Test install then remove package
  • Loading branch information
tienvx authored Mar 24, 2024
2 parents 69d6cb1 + fbc2492 commit 8a07ef9
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/Integration/Valid/InstallThenRemovePackageTest.php
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();
}
}
}

0 comments on commit 8a07ef9

Please sign in to comment.