public function PostContext::cleanupPost in Open Social 8
Same name and namespace in other branches
- 8.2 tests/behat/features/bootstrap/PostContext.php \PostContext::cleanupPost()
@AfterScenario @database&&@post
File
- tests/
behat/ features/ bootstrap/ PostContext.php, line 24
Class
- PostContext
- Defines application features from the specific context.
Code
public function cleanupPost(AfterScenarioScope $scope) {
$query = \Drupal::entityQuery('post')
->condition('field_post', array(
'This is a public post.',
'This is a community post.',
), 'IN');
$post_ids = $query
->execute();
$posts = entity_load_multiple('post', $post_ids);
foreach ($posts as $post) {
$post
->delete();
}
}