ComposerTest.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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;
  12. use Composer\Composer;
  13. use Composer\Test\TestCase;
  14. class ComposerTest extends TestCase
  15. {
  16. public function testSetGetPackage()
  17. {
  18. $composer = new Composer();
  19. $package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock();
  20. $composer->setPackage($package);
  21. $this->assertSame($package, $composer->getPackage());
  22. }
  23. public function testSetGetLocker()
  24. {
  25. $composer = new Composer();
  26. $locker = $this->getMockBuilder('Composer\Package\Locker')->disableOriginalConstructor()->getMock();
  27. $composer->setLocker($locker);
  28. $this->assertSame($locker, $composer->getLocker());
  29. }
  30. public function testSetGetRepositoryManager()
  31. {
  32. $composer = new Composer();
  33. $manager = $this->getMockBuilder('Composer\Repository\RepositoryManager')->disableOriginalConstructor()->getMock();
  34. $composer->setRepositoryManager($manager);
  35. $this->assertSame($manager, $composer->getRepositoryManager());
  36. }
  37. public function testSetGetDownloadManager()
  38. {
  39. $composer = new Composer();
  40. $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
  41. $manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')->setConstructorArgs(array($io))->getMock();
  42. $composer->setDownloadManager($manager);
  43. $this->assertSame($manager, $composer->getDownloadManager());
  44. }
  45. public function testSetGetInstallationManager()
  46. {
  47. $composer = new Composer();
  48. $manager = $this->getMockBuilder('Composer\Installer\InstallationManager')->disableOriginalConstructor()->getMock();
  49. $composer->setInstallationManager($manager);
  50. $this->assertSame($manager, $composer->getInstallationManager());
  51. }
  52. }