/** * @test */ public function deletePackageRemovesPackageFromAvailableAndActivePackagesAndDeletesThePackageDirectory() { $package = $this->packageManager->createPackage('Acme.YetAnotherTestPackage'); $packagePath = $package->getPackagePath(); $this->assertTrue(is_dir($packagePath . PackageInterface::DIRECTORY_METADATA)); $this->assertTrue($this->packageManager->isPackageActive('Acme.YetAnotherTestPackage')); $this->assertTrue($this->packageManager->isPackageAvailable('Acme.YetAnotherTestPackage')); $this->packageManager->deletePackage('Acme.YetAnotherTestPackage'); $this->assertFalse(is_dir($packagePath . PackageInterface::DIRECTORY_METADATA)); $this->assertFalse($this->packageManager->isPackageActive('Acme.YetAnotherTestPackage')); $this->assertFalse($this->packageManager->isPackageAvailable('Acme.YetAnotherTestPackage')); }
/** * @test */ public function deletePackageRemovesPackageFromAvailableAndActivePackagesAndDeletesThePackageDirectory() { $package = $this->packageManager->createPackage('Acme.YetAnotherTestPackage'); $packagePath = $package->getPackagePath(); $this->assertTrue(is_dir($packagePath . PackageInterface::DIRECTORY_CONFIGURATION), 'The package configuration directory does not exist.'); $this->assertTrue($this->packageManager->isPackageActive('Acme.YetAnotherTestPackage'), 'The package is not active.'); $this->assertTrue($this->packageManager->isPackageAvailable('Acme.YetAnotherTestPackage'), 'The package is not available.'); $this->packageManager->deletePackage('Acme.YetAnotherTestPackage'); $this->assertFalse(is_dir($packagePath . PackageInterface::DIRECTORY_CONFIGURATION), 'The package configuration directory does still exist.'); $this->assertFalse($this->packageManager->isPackageActive('Acme.YetAnotherTestPackage'), 'The package is still active.'); $this->assertFalse($this->packageManager->isPackageAvailable('Acme.YetAnotherTestPackage'), 'The package is still available.'); }
/** * Returns TRUE if a package is available (the package's files exist in the packages directory) * or FALSE if it's not. If a package is available it doesn't mean necessarily that it's active! * * @param string $packageKey The key of the package to check * @return boolean TRUE if the package is available, otherwise FALSE * @api */ public function isPackageAvailable($packageKey) { if (isset($this->packageAliasMap[$lowercasedPackageKey = strtolower($packageKey)])) { $packageKey = $this->packageAliasMap[$lowercasedPackageKey]; } return parent::isPackageAvailable($packageKey); }