private function FixtureBase::clearUserContent in Lightning Core 8.5
Same name and namespace in other branches
- 8.3 tests/src/FixtureBase.php \Drupal\Tests\lightning_core\FixtureBase::clearUserContent()
- 8.4 tests/src/FixtureBase.php \Drupal\Tests\lightning_core\FixtureBase::clearUserContent()
Deletes all content created by the current users.
1 call to FixtureBase::clearUserContent()
- FixtureBase::tearDown in tests/
src/ FixtureBase.php - Tears down the fixture.
File
- tests/
src/ FixtureBase.php, line 266
Class
- FixtureBase
- Base class for contexts which set up and tear down a complete test fixture.
Namespace
Drupal\Tests\lightning_coreCode
private function clearUserContent() {
if (!$this->users) {
return;
}
foreach ($this->trackedEntityTypes as $entity_type_id) {
/** @var \Drupal\Core\Entity\EntityStorageInterface $storage */
$storage = $this->container
->get('entity_type.manager')
->getStorage($entity_type_id);
$entities = $storage
->loadByProperties([
'uid' => $this->users,
]);
$storage
->delete($entities);
}
}