jhedstrom / drupalextension

An integration layer between Behat, Mink Extension, and Drupal.
GNU General Public License v2.0
209 stars 192 forks source link

Creating nodes has problem with Handlers #146

Closed dutchiexl closed 9 years ago

dutchiexl commented 9 years ago

Warning: Invalid argument supplied for foreach() in /Library/WebServer/Documents/cegeka/ftaworld/vendor/drupal/drupal-driver/src/Drupal/Driver/Fields/Drupal7/DefaultHandler.php line 22

The error is generated by this code: foreach ($values as $value) { $return[LANGUAGE_NONE][] = array('value' => $value); }

because not all values are arrays.

I changed the code to this: foreach ((array)$values as $value) { in all handlers which fixed the problem, but I am still having an issue with the body field, which doesn't seem to be saved.

dutchiexl commented 9 years ago

The body field has a problem for me because I don't accept language undefined. I am going to rework it tommorow so that it is possible to add languages.

ademarco commented 9 years ago

Yes, indeed, the next step for field handlers in D7 is to make them language aware. Could you share the scenario that generates the warning?

dutchiexl commented 9 years ago

@api Scenario: When a news item is created, I should be able to see it in the overview

  Given I created a "News" content:
  | title | News feature: News item 1 |
  | body        | This is a news item       |
  | field_date  | 2018-02-25 07:45:45       |
And I break
And I am on "/news"
Then I should see the link "News feature: News item 1" in the "main" region</code>
ademarco commented 9 years ago

Is Given I created a "News" content: a custom step definition?

dutchiexl commented 9 years ago

Yes it is, it is a copy of Given I am viewing ... but without the goto

jhedstrom commented 9 years ago

Is this still an issue? The corresponding issue was closed without being merged.

jhedstrom commented 9 years ago

Closing. Feel free to re-open if this is still happening.