ClockMock.php 681 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Console\Helper;
  11. use Symfony\Component\Console\Tests;
  12. function time()
  13. {
  14. return Tests\time();
  15. }
  16. namespace Symfony\Component\Console\Tests;
  17. function with_clock_mock($enable = null)
  18. {
  19. static $enabled;
  20. if (null === $enable) {
  21. return $enabled;
  22. }
  23. $enabled = $enable;
  24. }
  25. function time()
  26. {
  27. if (!with_clock_mock()) {
  28. return \time();
  29. }
  30. return $_SERVER['REQUEST_TIME'];
  31. }