Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I see from #2111271: Add handling for fields with arrays (was: Creating Addressfields), and from reading the code, that we try to handle fields with "sub field" arrays intelligently. IE when expandEntityFields encounters a field where $value is an array with named keys, we try to set the field accordingly.
What I don't understand is how that translates into Gherkin, in writing the actual test. So how would I go about using an addressfield or similar with tabular data? I'm looking for something like this:
Given I am viewing a Profile:
| name | ohthehugemanatee |
|address | array("street" => "123 Main st.", "state" => "VA", "zip" => "12345") |
Any help is appreciated.
Comments
Comment #1
nielsonm CreditAttribution: nielsonm commentedComment #2
nielsonm CreditAttribution: nielsonm commented@ohthehugemanatee,
Instead of having an array in the feature. It would probably be better to create a custom step definition to parse the address into the field. This keeps the feature cleaner and allows the step definition to be reused easily. Here's a short into to writing custom step definitions - http://knplabs.com/blog/2011/12/05/behat-like-a-boss-wirting-custom-steps