Behat/Gherkin — pull request #84 by Bendihossan (2014-08-06 14:12:52+00:00)
Title: Throw Exception if TableNode has no headers

@everzet - I'm not sure if what I've done here is right but I'll try and explain my thinking...

I'm using the ``snapii/behatch-contexts`` [TableContext](https://github.com/sanpii/behatch-contexts/blob/master/src/Context/TableContext.php) class which uses ``TableNode``. However if in the scenario the table has no headers then ``getColumnsHash()`` method returns an empty array which isn't helpful since the context can no longer do any work with it.

I think the problem is that the ``TableNode`` expects an array matching the format:

```php
array(
array('heading1', 'heading2'),
array('value1', 'value2')
)
```

But if given a table which only has one row (or rather an array containing only one array) the ``foreach`` never gets entered and and so the ``getColumnsHash()`` returns ``$hash`` as an empty array.

I thought it would be better if the method threw an exception to let users know that the table should have headers but after making this change I broke a few other tests.

I'm now no longer sure if this change is correct or what should be done however I don't think ``getColumnsHash()`` should be allowed to return an empty array. Are you able to provide some info on this? Hopefully we can clear up what should be going on here and make it more obvious how ``TableNode`` should work :)