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'm trying to use the Blackbox driver with an already existing (real) user but get the error message in the title. My questions:
- Can the Blackbox driver handle logged in users at all?
- If yes, how do I register a user with the driver?
- If not, how do I register a user with the API and/or Drush driver?
Any hints welcome as I haven't found any information about registering users in either the documentation or the source code.
TIA
Frank
Comments
Comment #1
jhedstromBy default, the Blackbox driver has no way of dealing with users. The Drupal.org BDD used to have some logic for dealing with a list of pre-defined users (see the behat.local.yml.example file that comes with it, where a
drupal_users
parameter is set). While I don't think this is being used anymore, at one time they had a custom step along the lines of:Given I am logged in as "..." user
The step definition then retrieved the username/pass combo from the preset parameter, and walked through the steps needed to log the user in on d.o.
Comment #2
Frank Ralf CreditAttribution: Frank Ralf commentedThanks for the quick reply. I'll have a look at the Doobie code.
Just for the curious here's an excerpt from behat.local.yml.example
And here's the step definition from \doobie\features\bootstrap\FeatureContext.php
Comment #3
Frank Ralf CreditAttribution: Frank Ralf commentedJFTR
I think I will solve the problem by using meta steps as described at http://knplabs.pl/blog/behat-like-a-boss-meta-steps
EDIT 1:
Following the instructions from the above URL I came up with the following feature using steps provided by the Mink extension.
(This is not yet a real meta step):
Comment #3.0
Frank Ralf CreditAttribution: Frank Ralf commentedAdded links to already researched resources.
Comment #4
Albert Volkman CreditAttribution: Albert Volkman commentedAbove link to KNPLabs' blog is broken. Here's the updated link-
http://knplabs.com/blog/2011/12/15/behat-like-a-boss-meta-steps/
Comment #5
jhedstromClosing out for now. Thanks for those links!
Comment #6
boinkster CreditAttribution: boinkster as a volunteer commentedAnd another updated link: http://knplabs.com/en/blog/behat-like-a-boss-meta-steps