More testing with Codeception and Drupal projects
This is a bit of a follow-up to Mike Bell's introductory article on using Codeception to create Drupal test suites. He concludes by stating he "need[s] to figure out a way of creating a Codeception module which allows you to plug in a Drupal testing user (ideally multiple so you can test each role) and then all the you have to do is call a function which executes the above steps to confirm your logged in before testing authenticated behaviour."
"Something along the lines of:
<span style="color: #0000ff;">$I</span>-<span style="color: #66cc66;">></span><span style="color: #006600;">drupalLogin</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'editor'</span><span style="color: #66cc66;">)</span>;
So, after skimming through Codeception and Mink documentation, I've tinkered with two potential ways of achieving this... for acceptance testing at least.
A crude toolbox
The first method is to use two custom classes to provide details of (a) a general Drupal site and (b) the specific site to be tested. This idea stemmed from this article which suggests that including literals - such as account credentials, paths and even form labels - in tests is bad practice. What if the login button label changes?