XdebugHandlerTest.php 1.3 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;
  12. use Composer\Test\Mock\XdebugHandlerMock as XdebugHandler;
  13. /**
  14. * @author John Stevenson <john-stevenson@blueyonder.co.uk>
  15. */
  16. class XdebugHandlerTest extends \PHPUnit_Framework_TestCase
  17. {
  18. protected $argv;
  19. public function setup()
  20. {
  21. $this->argv = $GLOBALS['argv'];
  22. }
  23. public function testRestartWhenLoaded()
  24. {
  25. $loaded = true;
  26. $xdebug = new XdebugHandler($this->argv, $loaded);
  27. $xdebug->check();
  28. $this->assertTrue($xdebug->restarted || !defined('PHP_BINARY'));
  29. }
  30. public function testNoRestartWhenNotLoaded()
  31. {
  32. $loaded = false;
  33. $xdebug = new XdebugHandler($this->argv, $loaded);
  34. $xdebug->check();
  35. $this->assertFalse($xdebug->restarted);
  36. }
  37. public function testNoRestartWhenLoadedAndAllowed()
  38. {
  39. $loaded = true;
  40. putenv(XdebugHandler::ENV_ALLOW.'=1');
  41. $xdebug = new XdebugHandler($this->argv, $loaded);
  42. $xdebug->check();
  43. $this->assertFalse($xdebug->restarted);
  44. }
  45. }