InstallerEventTest.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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\Installer;
  12. use Composer\Installer\InstallerEvent;
  13. use Composer\Test\TestCase;
  14. class InstallerEventTest extends TestCase
  15. {
  16. public function testGetter()
  17. {
  18. $composer = $this->getMockBuilder('Composer\Composer')->getMock();
  19. $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
  20. $policy = $this->getMockBuilder('Composer\DependencyResolver\PolicyInterface')->getMock();
  21. $pool = $this->getMockBuilder('Composer\DependencyResolver\Pool')->disableOriginalConstructor()->getMock();
  22. $installedRepo = $this->getMockBuilder('Composer\Repository\CompositeRepository')->disableOriginalConstructor()->getMock();
  23. $request = $this->getMockBuilder('Composer\DependencyResolver\Request')->disableOriginalConstructor()->getMock();
  24. $operations = array($this->getMockBuilder('Composer\DependencyResolver\Operation\OperationInterface')->getMock());
  25. $event = new InstallerEvent('EVENT_NAME', $composer, $io, true, $policy, $pool, $installedRepo, $request, $operations);
  26. $this->assertSame('EVENT_NAME', $event->getName());
  27. $this->assertInstanceOf('Composer\Composer', $event->getComposer());
  28. $this->assertInstanceOf('Composer\IO\IOInterface', $event->getIO());
  29. $this->assertTrue($event->isDevMode());
  30. $this->assertInstanceOf('Composer\DependencyResolver\PolicyInterface', $event->getPolicy());
  31. $this->assertInstanceOf('Composer\DependencyResolver\Pool', $event->getPool());
  32. $this->assertInstanceOf('Composer\Repository\CompositeRepository', $event->getInstalledRepo());
  33. $this->assertInstanceOf('Composer\DependencyResolver\Request', $event->getRequest());
  34. $this->assertCount(1, $event->getOperations());
  35. }
  36. }