function DatabaseEventsTest::testEventDispatchingWhenNoContainerAvailable
Same name in other branches
- 11.x core/tests/Drupal/Tests/Core/Database/DatabaseEventsTest.php \Drupal\Tests\Core\Database\DatabaseEventsTest::testEventDispatchingWhenNoContainerAvailable()
@covers ::dispatchEvent
File
-
core/
tests/ Drupal/ Tests/ Core/ Database/ DatabaseEventsTest.php, line 82
Class
- DatabaseEventsTest
- @coversDefaultClass \Drupal\Core\Database\Connection
Namespace
Drupal\Tests\Core\DatabaseCode
public function testEventDispatchingWhenNoContainerAvailable() : void {
$this->expectException(EventException::class);
$this->expectExceptionMessage('The event dispatcher service is not available. Database API events can only be fired if the container is initialized');
$this->connection
->dispatchEvent($this->createMock(DatabaseEvent::class));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.