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 QueryExecutor::rewrite(), so this class simply delegates to the core executor.
Methods§
public function __construct(QueryExecutor $executor)Parameters
$executor | QueryExecutor | Core execution pipeline. |
public function simulate(
string $statement,
callable(string): StatementInterface|false $executor,
): int|falseSimulate exec() by running result-select and updating shadow state.
QueryExecutor::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::testReadStatementReturnsFalseWhenExecutorFailscallsStatementSimulatorTest::testReadStatementReturnsRowCountcallsStatementSimulatorTest::testSimulateRefusesAWriteThePlanCarriesNoMutationForcallsStatementSimulatorTest::testUnsupportedSqlThrowscallsStatementSimulatorTest::testWriteStatementUpdatesShadowStorecalls
Calls 5
- method-call QueryExecutor::rewrite() line 44
- class-const QueryKind::SKIPPED() line 46
- class-const QueryKind::READ() line 50
- method-call QueryExecutor::runResultSelectAndApplyShadow() line 58
- function-call
countline 60
Private surface 1§
Implementation details, listed for orientation only.
private QueryExecutor $executorTest cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
StatementSimulatorTest::testReadStatementReturnsFalseWhenExecutorFailscallsStatementSimulatorTest::testReadStatementReturnsRowCountcallsStatementSimulatorTest::testSimulateRefusesAWriteThePlanCarriesNoMutationForcallsStatementSimulatorTest::testUnsupportedSqlThrowscallsStatementSimulatorTest::testWriteStatementUpdatesShadowStorecalls