InstallationManagerMock.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Test\Mock;
  12. use Composer\Installer\InstallationManager;
  13. use Composer\Repository\RepositoryInterface;
  14. use Composer\DependencyResolver\Operation\OperationInterface;
  15. use Composer\DependencyResolver\Operation\InstallOperation;
  16. use Composer\DependencyResolver\Operation\UpdateOperation;
  17. use Composer\DependencyResolver\Operation\UninstallOperation;
  18. class InstallationManagerMock extends InstallationManager
  19. {
  20. private $installed = array();
  21. private $updated = array();
  22. private $uninstalled = array();
  23. public function install(RepositoryInterface $repo, InstallOperation $operation)
  24. {
  25. $this->installed[] = $operation->getPackage();
  26. }
  27. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  28. {
  29. $this->updated[] = array($operation->getInitialPackage(), $operation->getTargetPackage());
  30. }
  31. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  32. {
  33. $this->uninstalled[] = $operation->getPackage();
  34. }
  35. public function getInstalledPackages()
  36. {
  37. return $this->installed;
  38. }
  39. public function getUpdatedPackages()
  40. {
  41. return $this->updated;
  42. }
  43. public function getUninstalledPackages()
  44. {
  45. return $this->uninstalled;
  46. }
  47. }