Implementing Our Gherkin Parser: Parsing a Single Scenario
Explore how to parse single Gherkin scenarios and backgrounds in Laravel using a unified parsing method. Understand how scenario and background structures overlap, and learn to implement parsing functions that transform Gherkin text lines into structured PHP objects for use in Laravel applications.
We'll cover the following...
We'll cover the following...
Parsing a single scenario and background
We will now work to parse a single Gherkin scenario and background structure. We will do this together because Gherkin’s backgrounds are similar to scenarios. If we look at the given example below, we can see that the two are structurally identical:
However, remember that during our data modeling process, we created two different PHP classes to represent these structures. Because these features are so ...