PostContext.php in Open Social 8.3
File
tests/behat/features/bootstrap/PostContext.php
View source
<?php
namespace Drupal\social\Behat;
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Drupal\DrupalExtension\Context\DrupalContext;
use Behat\MinkExtension\Context\RawMinkContext;
use PHPUnit_Framework_Assert as PHPUnit;
use Drupal\DrupalExtension\Hook\Scope\EntityScope;
use Behat\Behat\Hook\Scope\AfterScenarioScope;
class PostContext extends RawDrupalContext implements Context, SnippetAcceptingContext {
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();
}
}
}
Classes
Name |
Description |
PostContext |
Defines application features from the specific context. |