A
A
Arthur2019-05-09 10:49:59
Laravel
Arthur, 2019-05-09 10:49:59

Laravel functional tests and assertRedirect with not known parameter?

Good afternoon, I am writing a functional test, the sequence is as follows.
1.Send a post request with data.
2. The controller method processes the request and makes an entry in the database, after which a redirect is made.
The problem is in the redirect route, it has a required parameter id of the created entry. During the test, the id is not known and it will not be possible to check with the assertRedirect method.
I see the solution as follows, after creating the entry, make a request to the database and, based on the data, find the entry, then it will be possible to check the correctness of the redirect.
Are there better options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jazzus, 2019-05-09
@ART_CORP

after creation
before creation last id + 1)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question