server_mocks.php 558 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * A set of 'mocks' that replace the PHP global functions to aid testing.
  5. */
  6. namespace Cake\Http;
  7. function headers_sent()
  8. {
  9. return $GLOBALS['mockedHeadersSent'] ?? true;
  10. }
  11. function header($header)
  12. {
  13. $GLOBALS['mockedHeaders'][] = $header;
  14. }
  15. function setcookie($name, $value, $expire, $path, $domain, $secure = false, $httponly = false)
  16. {
  17. $GLOBALS['mockedCookies'][] = compact(
  18. 'name',
  19. 'value',
  20. 'expire',
  21. 'path',
  22. 'domain',
  23. 'secure',
  24. 'httponly'
  25. );
  26. }