TestWebSession.php 433 B

123456789101112131415161718192021222324
  1. <?php
  2. declare(strict_types=1);
  3. namespace TestApp\Http\Session;
  4. use Cake\Http\Session;
  5. /**
  6. * Overwrite Session to simulate a web session even if the test runs on CLI.
  7. */
  8. class TestWebSession extends Session
  9. {
  10. protected function _hasSession(): bool
  11. {
  12. $isCLI = $this->_isCLI;
  13. $this->_isCLI = false;
  14. $result = parent::_hasSession();
  15. $this->_isCLI = $isCLI;
  16. return $result;
  17. }
  18. }