MockWebRequest.php 475 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * A mock WebRequest.
  4. *
  5. * If the code under test accesses the response via the request (see
  6. * WebRequest#response), then you might be able to use this mock to simplify
  7. * your tests.
  8. */
  9. class MockWebRequest extends WebRequest {
  10. /**
  11. * @var WebResponse
  12. */
  13. protected $response;
  14. public function __construct( WebResponse $response ) {
  15. parent::__construct();
  16. $this->response = $response;
  17. }
  18. public function response() {
  19. return $this->response;
  20. }
  21. }