protected function EntityUsageTest::setUp in Entity Usage 8
Same name and namespace in other branches
- 8.4 tests/src/Kernel/EntityUsageTest.php \Drupal\Tests\entity_usage\Kernel\EntityUsageTest::setUp()
- 8.2 tests/src/Kernel/EntityUsageTest.php \Drupal\Tests\entity_usage\Kernel\EntityUsageTest::setUp()
- 8.3 tests/src/Kernel/EntityUsageTest.php \Drupal\Tests\entity_usage\Kernel\EntityUsageTest::setUp()
Overrides EntityKernelTestBase::setUp
File
- tests/
src/ Kernel/ EntityUsageTest.php, line 71
Class
- EntityUsageTest
- Tests the basic API operations of our tracking service..
Namespace
Drupal\Tests\entity_usage\KernelCode
protected function setUp() {
parent::setUp();
$this->injectedDatabase = $this->container
->get('database');
$this
->installSchema('entity_usage', [
'entity_usage',
]);
$this->tableName = 'entity_usage';
// Create two test entities.
$this->testEntities = $this
->getTestEntities();
$this->state = \Drupal::state();
\Drupal::service('event_dispatcher')
->addListener(Events::USAGE_ADD, [
$this,
'usageAddEventRecorder',
]);
\Drupal::service('event_dispatcher')
->addListener(Events::USAGE_DELETE, [
$this,
'usageDeleteEventRecorder',
]);
\Drupal::service('event_dispatcher')
->addListener(Events::BULK_TARGETS_DELETE, [
$this,
'usageBulkTargetDeleteEventRecorder',
]);
\Drupal::service('event_dispatcher')
->addListener(Events::BULK_HOSTS_DELETE, [
$this,
'usageBulkHostsDeleteEventRecorder',
]);
}