server_mocks.php 571 B

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