F
F
Fedooot012021-09-22 13:11:57
Unit testing
Fedooot01, 2021-09-22 13:11:57

How to store large HTML text for use in Laravel tests?

My Laravel application makes HTTP requests, receives an HTML response, and needs to parse information from it. I want to cover the functionality of parsing information from the response with unit tests.

Tell me please:

  1. Where and how to store a large piece of HTML code that will be used in tests, on which the parsing functionality will be tested?
  2. How to organize testing of the functionality that makes HTTP requests to the server?

Also, in addition to unit tests, I would like to add a feature test that will test the chain from the moment of the HTTP request to the moment the parsed information is received. I believe that for this it will be necessary to somehow raise a test HTTP server locally, to which requests will allegedly be made.
How to do this and where to store the large pieces of HTML code prepared for it for responses?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question