public function SocialDrupalContext::createNodes in Open Social 8.6
Same name and namespace in other branches
- 8.9 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::createNodes()
- 8.3 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::createNodes()
- 8.4 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::createNodes()
- 8.5 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::createNodes()
- 8.7 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::createNodes()
- 8.8 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::createNodes()
- 10.3.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::createNodes()
- 10.0.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::createNodes()
- 10.1.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::createNodes()
- 10.2.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::createNodes()
@override DrupalContext:createNodes().
To support relative dates.
File
- tests/
behat/ features/ bootstrap/ SocialDrupalContext.php, line 119
Class
- SocialDrupalContext
- Provides pre-built step definitions for interacting with Open Social.
Namespace
Drupal\social\BehatCode
public function createNodes($type, TableNode $nodesTable) {
foreach ($nodesTable
->getHash() as $nodeHash) {
$node = (object) $nodeHash;
$node->type = $type;
if (isset($node->field_event_date)) {
$node->field_event_date = date('Y-m-d H:i:s', strtotime($node->field_event_date));
}
$entity = $this
->nodeCreate($node);
if (isset($node->alias)) {
\Drupal::service('path.alias_storage')
->save("/node/" . $entity->nid, $node->alias);
}
}
}