Before submitting a patch, we should discuss what kinds of test we want to run in behat and which steps would be most useful.
In the meantime, I will share some code where have created a table-style step where you can define registrations:
/**
* @Given registrations:
*/
public function pushRegistrations(TableNode $regTable)
{
$registrations = array();
foreach ($regTable->getHash() as $regHash) {
if(!isset($regHash['user'])) {
throw new \Exception("Missing user field for registration");
}
$user = user_load_by_name($regHash['user']);
if(!isset($user->uid)) {
throw new \Exception("Invalid user for registration");
}
$regHash['user_uid'] = $user->uid;
unset($regHash['user']);
if(!isset($regHash['event'])) {
throw new \Exception("Missing event field for registration");
}
$query = new EntityFieldQuery();
$entities = $query->entityCondition('entity_type', 'node')
->propertyCondition('title', $regHash['event'])
->range(0,1)
->execute();
if (!empty($entities['node'])) {
$nids = array_keys($entities['node']);
$node = node_load(array_shift($nids));
}
$regHash['entity_type'] = 'node';
$regHash['entity_id'] = $node->nid;
unset($regHash['event']);
$registration = entity_get_controller('registration')->create($regHash);
$registration->count = 1;
$registration->save();
}
}
It will match user and node by title.
Example:
Given registrations:
| event | state | type | user |
| EC Test Event 1 | Complete | Default | EC Testuser 11 |
| EC Test Event 1 | Complete | Default | EC Testuser 10 |
| EC Test Event 1 | Complete | Default | EC Testuser 9 |
| EC Test Event 1 | Complete | Default | EC Testuser 8 |
| EC Test Event 1 | Complete | Default | EC Testuser 7 |
| EC Test Event 1 | Complete | Default | EC Testuser 6 |
| EC Test Event 1 | Complete | Default | EC Testuser 5 |
| EC Test Event 1 | Complete | Default | EC Testuser 4 |
| EC Test Event 1 | Complete | Default | EC Testuser 3 |
| EC Test Event 1 | Complete | Default | EC Testuser 2 |
| EC Test Event 1 | Complete | Default | EC Testuser 1 |
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.