classStatementSimulator
final class StatementSimulator
Executes rewritten statements and applies shadow mutations for exec().
Exception handling for unsupported SQL and unknown schema is now done in Session::rewrite(), so this class simply delegates to the session.
Methods§
public function __construct(Session $session)Parameters
$session | Session | Current ZTD session. |
Test cases 5
StatementSimulatorTest::testReadStatementReturnsFalseWhenExecutorFailscoversStatementSimulatorTest::testReadStatementReturnsRowCountcoversStatementSimulatorTest::testSimulateRefusesAWriteThePlanCarriesNoMutationForcoversStatementSimulatorTest::testUnsupportedSqlThrowscoversStatementSimulatorTest::testWriteStatementUpdatesShadowStorecovers
public function simulate(
string $statement,
callable(string): StatementInterface|false $executor,
): int|falseSimulate exec() by running result-select and updating shadow state.
Session::rewrite() now handles exceptions for unsupported SQL and unknown schema based on config, so we no longer need to handle FORBIDDEN/UNKNOWN_SCHEMA here.
Parameters
$statement | string | |
$executor | callable(string): StatementInterface|false |
Returns
int|falseTest cases 5
StatementSimulatorTest::testReadStatementReturnsFalseWhenExecutorFailscovers and callsStatementSimulatorTest::testReadStatementReturnsRowCountcovers and callsStatementSimulatorTest::testSimulateRefusesAWriteThePlanCarriesNoMutationForcovers and callsStatementSimulatorTest::testUnsupportedSqlThrowscovers and callsStatementSimulatorTest::testWriteStatementUpdatesShadowStorecovers and calls
Calls 5
- method-call Session::rewrite() line 44
- class-const QueryKind::SKIPPED() line 46
- class-const QueryKind::READ() line 50
- method-call Session::runResultSelectAndApplyShadow() line 58
- function-call
countline 60
Private surface 1§
Implementation details, listed for orientation only.
private Session $sessionTest cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
StatementSimulatorTest::testReadStatementReturnsFalseWhenExecutorFailscovers and callsStatementSimulatorTest::testReadStatementReturnsRowCountcovers and callsStatementSimulatorTest::testSimulateRefusesAWriteThePlanCarriesNoMutationForcovers and callsStatementSimulatorTest::testUnsupportedSqlThrowscovers and callsStatementSimulatorTest::testWriteStatementUpdatesShadowStorecovers and calls