public function FeatureContext::createUnits in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
@Given /^"(?P<type>[^"]*)" units:$/
File
- test/
features/ bootstrap/ FeatureContext.php, line 304
Class
- FeatureContext
- Features context.
Code
public function createUnits($type, TableNode $nodesTable) {
foreach ($nodesTable
->getHash() as $nodeHash) {
$nodeHash['type'] = $type;
$nodeHash += array(
'default_state' => 1,
);
$unit = rooms_unit_create($nodeHash);
if (isset($this->user->uid)) {
$unit->uid = $this->user->uid;
}
$unit
->save();
$this->units[] = $unit;
}
}