/**
* Tests statement execution events.
*/
public function testStatementExecutionEvents(): void
{ $subscriber =
$this->container->
get(DatabaseEventSubscriber::
class);
// At first, no events have occurred, and events are not enabled.
$this->
assertSame(0,
$subscriber->countStatementStarts
);
$this->
assertSame(0,
$subscriber->countStatementEnds
);
$this->
assertEmpty($subscriber->statementIdsInExecution
);
$this->
assertFalse($this->connection->
isEventEnabled(StatementExecutionStartEvent::
class));
$this->
assertFalse($this->connection->
isEventEnabled(StatementExecutionEndEvent::
class));
// Execute a query, still no events captured.
$this->connection->
query('SELECT * FROM {test}'
);
$this->
assertSame(0,
$subscriber->countStatementStarts
);
$this->
assertSame(0,
$subscriber->countStatementEnds
);
$this->
assertEmpty($subscriber->statementIdsInExecution
);
$this->
assertFalse($this->connection->
isEventEnabled(StatementExecutionStartEvent::
class));
$this->
assertFalse($this->connection->
isEventEnabled(StatementExecutionEndEvent::
class));
// Enable the statement execution start event and execute a query, start