Assertion for multiple messages potentially getting it wrong
In class MessageContext I have contributed some code for multiple message assertions about a year ago and only today have I realised that this code potentially gets it wrong if the syntax of the step definition is wrong but the parser wouldn't even recognise that wrong syntax.
Here is an example:
Then I should see the following error messages:
| Something is wrong. |
| And something else is wrong. |
The problem is that this assertion expects a TableNode as a parameter and then loops through $messages->getHash() which assumes the first row to be the header of the TableNode and simply skips that and only walks through row 2 and following.
At least that's what my debugging session highlighted and if that conclusion is correct, then I wonder what could be done to make sure that an editor of tests doesn't forget about the table header and therefore the first row never gets tested at all.
This is not only in assertMultipleErrors() but also in a couple of similar assertions in the same class.
Can we fix this via documentation and make people always use the header?