Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Updated: Comment #10
Problem/Motivation
When I run the scenario "Scenario: Test ability to create nodes" from api.feature, I get the exception
No ability to create nodes in Drupal\Driver\DrushDriver
Is it supposed to throw this exception?
Proposed resolution
1. Use the devel_generate module
2. In behat.yml, set the default api driver and drupal_root. (See comment #6)
3. See #1823602: Need a framework for creating nodes (in drush driver)
Remaining tasks
Choose a solution and implement it. (or propose others)
Comments
Comment #1
kssundar CreditAttribution: kssundar commentedAdjusting title
Comment #2
jhedstromUntil there is a way to create nodes in Drush, this is intentional. It has been suggested that one way to do this would be to use the devel_generate module, but that's a pretty big assumption that people would have that module.
Comment #3
jjozwiak CreditAttribution: jjozwiak commentedI'm getting the same error while running the following feature that Ryan Weaver presented at Drupalcon Portland. Has anything changed on this between last November and June? Somehow it worked for him. Ideas why I'm getting this error?
Comment #4
b2f CreditAttribution: b2f commented@jjozwiak
Have your configured your behat.yml with a drush alias or Drupal path ?
Then you seem to have forgotten the @api tag above your Scenario (or Feature), because your must be using a Drupal installation / API to login with a role.
Did you write on top:
Comment #5
jhedstromAs I said in #2 there is currently no way to create nodes via the drush driver (drush itself has no built in code to create nodes).
Comment #6
alexkb CreditAttribution: alexkb commentedIn your behat.yml, if you set the default api driver and the drupal_root, then your create node scenarios should work, albeit a bit slower (using drupal web instead of drush). e.g.
Comment #7
pbuyle CreditAttribution: pbuyle commentedI doubt Drush itself will ever provide a command to create node. AFAIK, there is no standardized serialization of a node (in Drupal 7), so a create node command will either have an awful number of dynamic options or rely on a non standardized node serialization.
But the presence of contrib Drush commands, or worse contrib modules installed on the tested site, is a big assumption that the Behat Drupal Extension should probably not make.
An option may be for Behat Drupal Extension to provide the additional Drush commands needed by the Drush Driver. The command file(s) can be included in Drush when run through the Drush Driver using the --include option (see `drush topic docs-configuration`).
Once such a system is in place, a custom Behat tailored 'add node' command could be added.
Comment #8
pbuyle CreditAttribution: pbuyle commentedComment #9
areke CreditAttribution: areke commentedUse summary template
Comment #10
areke CreditAttribution: areke commentedFix typo
Comment #11
eliza411 CreditAttribution: eliza411 commentedI'm closing this in favor of Jonathan's issue so there's just one place to look for progress: #1823602: Need a framework for creating nodes (in drush driver)