XdebugHandlerMock.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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\Factory;
  13. use Composer\XdebugHandler;
  14. class XdebugHandlerMock extends XdebugHandler
  15. {
  16. public $restarted;
  17. public $output;
  18. public $testVersion = '2.5.0';
  19. public function __construct($loaded = null)
  20. {
  21. $this->output = Factory::createOutput();
  22. parent::__construct($this->output);
  23. $loaded = null === $loaded ? true: $loaded;
  24. $class = new \ReflectionClass(get_parent_class($this));
  25. $prop = $class->getProperty('loaded');
  26. $prop->setAccessible(true);
  27. $prop->setValue($this, $loaded);
  28. $prop = $class->getProperty('version');
  29. $prop->setAccessible(true);
  30. $version = $loaded ? $this->testVersion : '';
  31. $prop->setValue($this, $version);
  32. $this->restarted = false;
  33. }
  34. protected function restart($command)
  35. {
  36. $this->restarted = true;
  37. }
  38. }