public function SocialDrupalContext::assertViewingNode in Open Social 8
Same name and namespace in other branches
- 8.2 tests/behat/features/bootstrap/SocialDrupalContext.php \SocialDrupalContext::assertViewingNode()
@override DrupalContext:assertViewingNode().
To support relative dates.
File
- tests/
behat/ features/ bootstrap/ SocialDrupalContext.php, line 66
Class
- SocialDrupalContext
- Provides pre-built step definitions for interacting with Open Social.
Code
public function assertViewingNode($type, TableNode $fields) {
$node = (object) array(
'type' => $type,
);
foreach ($fields
->getRowsHash() as $field => $value) {
if (strpos($field, 'date') !== FALSE) {
$value = date('Y-m-d H:i:s', strtotime($value));
}
$node->{$field} = $value;
}
$saved = $this
->nodeCreate($node);
// Set internal browser on the node.
$this
->getSession()
->visit($this
->locatePath('/node/' . $saved->nid));
}