XdebugHandlerTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. public function testRestartWhenLoaded()
  19. {
  20. $loaded = true;
  21. $xdebug = new XdebugHandler($loaded);
  22. $xdebug->check();
  23. $this->assertTrue($xdebug->restarted || !defined('PHP_BINARY'));
  24. }
  25. public function testNoRestartWhenNotLoaded()
  26. {
  27. $loaded = false;
  28. $xdebug = new XdebugHandler($loaded);
  29. $xdebug->check();
  30. $this->assertFalse($xdebug->restarted);
  31. }
  32. public function testNoRestartWhenLoadedAndAllowed()
  33. {
  34. $loaded = true;
  35. putenv(XdebugHandler::ENV_ALLOW.'=1');
  36. $xdebug = new XdebugHandler($loaded);
  37. $xdebug->check();
  38. $this->assertFalse($xdebug->restarted);
  39. }
  40. }