protected function EntityUsageTest::setUp in Entity Usage 8.3
Same name and namespace in other branches
- 8.4 tests/src/Kernel/EntityUsageTest.php \Drupal\Tests\entity_usage\Kernel\EntityUsageTest::setUp()
- 8 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()
Overrides EntityKernelTestBase::setUp
File
- tests/
src/ Kernel/ EntityUsageTest.php, line 70
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 = $this->container
->get('state');
$event_dispatcher = $this->container
->get('event_dispatcher');
$event_dispatcher
->addListener(Events::USAGE_REGISTER, [
$this,
'usageRegisterEventRecorder',
]);
$event_dispatcher
->addListener(Events::USAGE_DELETE, [
$this,
'usageDeleteEventRecorder',
]);
$event_dispatcher
->addListener(Events::DELETE_BY_SOURCE_ENTITY, [
$this,
'usageDeleteBySourceEntityEventRecorder',
]);
$event_dispatcher
->addListener(Events::DELETE_BY_TARGET_ENTITY, [
$this,
'usageDeleteByTargetEntityEventRecorder',
]);
$event_dispatcher
->addListener(Events::BULK_DELETE_DESTINATIONS, [
$this,
'usageBulkTargetDeleteEventRecorder',
]);
$event_dispatcher
->addListener(Events::BULK_DELETE_SOURCES, [
$this,
'usageBulkSourceDeleteEventRecorder',
]);
}