classZtdConfig
final class ZtdConfig
Configuration for ZTD behavior.
Methods§
public function __construct(
UnsupportedSqlBehavior $unsupportedBehavior = UnsupportedSqlBehavior::Exception,
UnknownSchemaBehavior $unknownSchemaBehavior = UnknownSchemaBehavior::Passthrough,
array<string, UnsupportedSqlBehavior> $behaviorRules = [],
)Parameters
$unsupportedBehavior | UnsupportedSqlBehavior | How to handle unsupported SQL. |
$unknownSchemaBehavior | UnknownSchemaBehavior | How to handle unknown schema references. |
$behaviorRules | array<string, UnsupportedSqlBehavior> | Pattern-to-behavior mapping (first match wins). |
Test cases 13
ZtdConfigTest::testBehaviorRulesReturnsConfiguredRulescoversZtdConfigTest::testDefaultCreatesConfigWithExceptionBehaviorcoversZtdConfigTest::testEmptyBehaviorRulescoversZtdConfigTest::testFirstMatchWinscoversZtdConfigTest::testGetBehaviorForReturnsMatchingRuleBehaviorcoversZtdConfigTest::testGetBehaviorForReturnsNullWhenNoMatchcoversZtdConfigTest::testMixedPrefixAndRegexRulescoversZtdConfigTest::testPrefixMatchingBehaviorcoversZtdConfigTest::testRegexMatchingBehaviorcoversZtdConfigTest::testResolveUnsupportedBehaviorUsesDefaultWhenNoMatchcoversZtdConfigTest::testResolveUnsupportedBehaviorUsesMatchingRulecoversZtdConfigTest::testUnknownSchemaBehaviorReturnsConfiguredValuecoversZtdConfigTest::testUnsupportedBehaviorReturnsConfiguredValuecovers
Calls 3
- class-const UnsupportedSqlBehavior::Exception() line 35
- class-const UnknownSchemaBehavior::Passthrough() line 36
- new SqlBehaviorRule line 44
public static function default(): selfCreate a default configuration with Exception behavior.
Returns
selfTest cases 17
SessionUnderTest::overcallsZtdConfigTest::testDefaultCreatesConfigWithExceptionBehaviorcovers and callsSessionFactoryTest::testCreateAnswersASessionThatHasSimulatedNothingYetcallsSessionFactoryTest::testCreateAnswersASessionThatIsAlreadyOncallsSessionFactoryTest::testCreateReadsEveryTableTheDatabaseAlreadyHascallsSessionTest::testBeginTransactionRollBackTransactionBeginTransactionUsesProvidedTransactionManagerForSchemaRollbackcallsSessionTest::testDisableEnableDisableEnableAndDisablecallsSessionTest::testForeignKeyFailureRestoresShadowStatecallsSessionTest::testMutationFailureIsConvertedToDatabaseExceptioncallsSessionTest::testParameterBindingCompilerResultColumnTypeResolverParameterBindingCompilerDelegatesCopyTargetsToTheConfiguredPlatformSupportcallsSessionTest::testSplitStatementsUsesPlatformRewritercallsSessionTest::testTableDefinitionReturnsRegisteredSchemaOrNullcallsStatementSimulatorTest::testReadStatementReturnsFalseWhenExecutorFailscallsStatementSimulatorTest::testReadStatementReturnsRowCountcallsStatementSimulatorTest::testSimulateRefusesAWriteThePlanCarriesNoMutationForcallsStatementSimulatorTest::testUnsupportedSqlThrowscallsStatementSimulatorTest::testWriteStatementUpdatesShadowStorecalls
Calls 1
- new
selfline 53
public function unsupportedBehavior(): UnsupportedSqlBehaviorGet the default unsupported SQL behavior mode.
Returns
Test cases 2
public function unknownSchemaBehavior(): UnknownSchemaBehaviorGet the unknown schema behavior mode.
Returns
Test cases 2
Called from 1
public function behaviorRules(): list<SqlBehaviorRule>public function getBehaviorFor(string $sql): ?UnsupportedSqlBehaviorGet the behavior for a specific SQL statement.
Checks behavior rules in order; first matching rule determines behavior. Returns null if no rule matches (use default unsupportedBehavior).
Parameters
$sql | string |
Returns
Test cases 9
ZtdConfigTest::testEmptyBehaviorRulescovers and callsZtdConfigTest::testFirstMatchWinscovers and callsZtdConfigTest::testGetBehaviorForReturnsMatchingRuleBehaviorcovers and callsZtdConfigTest::testGetBehaviorForReturnsNullWhenNoMatchcovers and callsZtdConfigTest::testMixedPrefixAndRegexRulescovers and callsZtdConfigTest::testPrefixMatchingBehaviorcovers and callsZtdConfigTest::testRegexMatchingBehaviorcovers and callsZtdConfigTest::testResolveUnsupportedBehaviorUsesDefaultWhenNoMatchcoversZtdConfigTest::testResolveUnsupportedBehaviorUsesMatchingRulecovers
public function resolveUnsupportedBehavior(string $sql): UnsupportedSqlBehaviorResolve the effective behavior for a SQL statement.
Uses rule-specific behavior if a rule matches, otherwise default behavior.
Parameters
$sql | string |
Returns
Test cases 3
ZtdConfigTest::testEmptyBehaviorRulescovers and callsZtdConfigTest::testResolveUnsupportedBehaviorUsesDefaultWhenNoMatchcovers and callsZtdConfigTest::testResolveUnsupportedBehaviorUsesMatchingRulecovers and calls
Called from 1
Calls 1
- method-call ZtdConfig::getBehaviorFor() line 106
Private surface 3§
Implementation details, listed for orientation only.
private UnsupportedSqlBehavior $unsupportedBehaviorprivate UnknownSchemaBehavior $unknownSchemaBehaviorprivate list<SqlBehaviorRule> $behaviorRulesTest cases 37§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 13
ZtdConfigTest::testBehaviorRulesReturnsConfiguredRulescovers and callsZtdConfigTest::testDefaultCreatesConfigWithExceptionBehaviorcovers and callsZtdConfigTest::testEmptyBehaviorRulescovers and callsZtdConfigTest::testFirstMatchWinscovers and callsZtdConfigTest::testGetBehaviorForReturnsMatchingRuleBehaviorcovers and callsZtdConfigTest::testGetBehaviorForReturnsNullWhenNoMatchcovers and callsZtdConfigTest::testMixedPrefixAndRegexRulescovers and callsZtdConfigTest::testPrefixMatchingBehaviorcovers and callsZtdConfigTest::testRegexMatchingBehaviorcovers and callsZtdConfigTest::testResolveUnsupportedBehaviorUsesDefaultWhenNoMatchcovers and callsZtdConfigTest::testResolveUnsupportedBehaviorUsesMatchingRulecovers and callsZtdConfigTest::testUnknownSchemaBehaviorReturnsConfiguredValuecovers and callsZtdConfigTest::testUnsupportedBehaviorReturnsConfiguredValuecovers and calls
Other tests reaching this symbol 24
FakeSessionFactorycallsSessionUnderTest::overcallsSessionFactoryTest::testCreateAnswersASessionThatHasSimulatedNothingYetcallsSessionFactoryTest::testCreateAnswersASessionThatIsAlreadyOncallsSessionFactoryTest::testCreateReadsEveryTableTheDatabaseAlreadyHascallsRewriteRefusalTest::testForUnknownSchemaLetsTheStatementThroughWhereTheCallerAsksForThatcallsRewriteRefusalTest::testForUnknownSchemaRaisesWhereTheCallerAskedToBeToldcallsRewriteRefusalTest::testForUnknownSchemaReadsNothingBackWhereTheCallerAsksForThatcallsRewriteRefusalTest::testForUnknownSchemaSaysSomethingWhereTheCallerAskedToBeNoticedcallsRewriteRefusalTest::testForUnsupportedAnswersAPlanThatDoesNothingWhereTheCallerAllowsThatcallsRewriteRefusalTest::testForUnsupportedRaisesWhereTheCallerAskedToBeToldcallsRewriteRefusalTest::testForUnsupportedSaysSomethingWhereTheCallerAskedToBeNoticedcallsSessionTest::testBeginTransactionRollBackTransactionBeginTransactionUsesProvidedTransactionManagerForSchemaRollbackcallsSessionTest::testDisableEnableDisableEnableAndDisablecallsSessionTest::testForeignKeyFailureRestoresShadowStatecallsSessionTest::testMutationFailureIsConvertedToDatabaseExceptioncallsSessionTest::testParameterBindingCompilerResultColumnTypeResolverParameterBindingCompilerDelegatesCopyTargetsToTheConfiguredPlatformSupportcallsSessionTest::testSplitStatementsUsesPlatformRewritercallsSessionTest::testTableDefinitionReturnsRegisteredSchemaOrNullcallsStatementSimulatorTest::testReadStatementReturnsFalseWhenExecutorFailscallsStatementSimulatorTest::testReadStatementReturnsRowCountcallsStatementSimulatorTest::testSimulateRefusesAWriteThePlanCarriesNoMutationForcallsStatementSimulatorTest::testUnsupportedSqlThrowscallsStatementSimulatorTest::testWriteStatementUpdatesShadowStorecalls