PostContext.php in Open Social 10.0.x
Same filename and directory in other branches
- 8.9 tests/behat/features/bootstrap/PostContext.php
- 8 tests/behat/features/bootstrap/PostContext.php
- 8.2 tests/behat/features/bootstrap/PostContext.php
- 8.3 tests/behat/features/bootstrap/PostContext.php
- 8.4 tests/behat/features/bootstrap/PostContext.php
- 8.5 tests/behat/features/bootstrap/PostContext.php
- 8.6 tests/behat/features/bootstrap/PostContext.php
- 8.7 tests/behat/features/bootstrap/PostContext.php
- 8.8 tests/behat/features/bootstrap/PostContext.php
- 10.3.x tests/behat/features/bootstrap/PostContext.php
- 10.1.x tests/behat/features/bootstrap/PostContext.php
- 10.2.x tests/behat/features/bootstrap/PostContext.php
Namespace
Drupal\social\BehatFile
tests/behat/features/bootstrap/PostContext.phpView source
<?php
// @codingStandardsIgnoreFile
namespace Drupal\social\Behat;
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\AfterScenarioScope;
/**
* Defines application features from the specific context.
*/
class PostContext extends RawDrupalContext implements Context {
/**
* @AfterScenario @database&&@post
*/
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 = \Drupal::entityTypeManager()
->getStorage('post')
->loadMultiple($post_ids);
foreach ($posts as $post) {
$post
->delete();
}
}
}
Classes
Name![]() |
Description |
---|---|
PostContext | Defines application features from the specific context. |