20201112
This commit is contained in:
@@ -11,10 +11,9 @@
|
||||
|
||||
namespace think\composer;
|
||||
|
||||
|
||||
use Composer\Installer\LibraryInstaller;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Repository\InstalledRepositoryInterface;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class ThinkTesting extends LibraryInstaller
|
||||
{
|
||||
@@ -24,7 +23,7 @@ class ThinkTesting extends LibraryInstaller
|
||||
public function getInstallPath(PackageInterface $package)
|
||||
{
|
||||
if ('topthink/think-testing' !== $package->getPrettyName()) {
|
||||
throw new \InvalidArgumentException('Unable to install this library!');
|
||||
throw new InvalidArgumentException('Unable to install this library!');
|
||||
}
|
||||
|
||||
return parent::getInstallPath($package);
|
||||
@@ -32,19 +31,16 @@ class ThinkTesting extends LibraryInstaller
|
||||
|
||||
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
|
||||
{
|
||||
parent::install($repo, $package);
|
||||
|
||||
$this->copyTestDir($package);
|
||||
|
||||
|
||||
parent::install($repo, $package)->then(function () use ($package) {
|
||||
$this->copyTestDir($package);
|
||||
});
|
||||
}
|
||||
|
||||
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
|
||||
{
|
||||
parent::update($repo, $initial, $target);
|
||||
|
||||
$this->copyTestDir($target);
|
||||
|
||||
return parent::update($repo, $initial, $target)->then(function () use ($target) {
|
||||
$this->copyTestDir($target);
|
||||
});
|
||||
}
|
||||
|
||||
private function copyTestDir(PackageInterface $package)
|
||||
@@ -65,4 +61,4 @@ class ThinkTesting extends LibraryInstaller
|
||||
{
|
||||
return 'think-testing' === $packageType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user