Skip to content

Commit d71a188

Browse files
wol-softclaude
andcommitted
Fix tests to use meta()->rawInput() instead of getRawModelDataInput()
The updated production library exposes raw input via meta()->rawInput() on the generated model. Replace direct getRawModelDataInput() calls in the branch-default test suite accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0ed8e09 commit d71a188

4 files changed

Lines changed: 41 additions & 41 deletions

tests/ComposedValue/ComposedAllOfAnyOfBranchDefaultTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ public function testAllOfBranchDefaultsAppliedFromAllBranches(): void
3535
$this->assertSame(30, $noInput->getTimeout());
3636
$this->assertSame(3, $noInput->getRetries());
3737
// Both values came from branch defaults; neither is present in raw input.
38-
$this->assertSame([], $noInput->getRawModelDataInput());
38+
$this->assertSame([], $noInput->meta()->rawInput());
3939

4040
// Both values user-supplied: defaults are bypassed.
4141
$bothSupplied = new $className(['timeout' => 100, 'retries' => 5]);
4242
$this->assertSame(100, $bothSupplied->getTimeout());
4343
$this->assertSame(5, $bothSupplied->getRetries());
44-
$this->assertSame(['timeout' => 100, 'retries' => 5], $bothSupplied->getRawModelDataInput());
44+
$this->assertSame(['timeout' => 100, 'retries' => 5], $bothSupplied->meta()->rawInput());
4545

4646
// Only one value user-supplied: the other still gets its branch default.
4747
$partialInput = new $className(['timeout' => 100]);
4848
$this->assertSame(100, $partialInput->getTimeout());
4949
$this->assertSame(3, $partialInput->getRetries());
5050
// retries came from the branch default; only the user-supplied timeout is in raw input.
51-
$this->assertSame(['timeout' => 100], $partialInput->getRawModelDataInput());
51+
$this->assertSame(['timeout' => 100], $partialInput->meta()->rawInput());
5252
}
5353

5454
/**
@@ -68,20 +68,20 @@ public function testAnyOfBranchDefaultsAppliedFromAllMatchingBranches(): void
6868
$this->assertSame(30, $noInput->getTimeout());
6969
$this->assertSame(3, $noInput->getRetries());
7070
// Both values came from branch defaults; neither is present in raw input.
71-
$this->assertSame([], $noInput->getRawModelDataInput());
71+
$this->assertSame([], $noInput->meta()->rawInput());
7272

7373
// Both values user-supplied: defaults are bypassed.
7474
$bothSupplied = new $className(['timeout' => 100, 'retries' => 5]);
7575
$this->assertSame(100, $bothSupplied->getTimeout());
7676
$this->assertSame(5, $bothSupplied->getRetries());
77-
$this->assertSame(['timeout' => 100, 'retries' => 5], $bothSupplied->getRawModelDataInput());
77+
$this->assertSame(['timeout' => 100, 'retries' => 5], $bothSupplied->meta()->rawInput());
7878

7979
// Only one value user-supplied: the other still gets its branch default.
8080
$partialInput = new $className(['retries' => 5]);
8181
$this->assertSame(30, $partialInput->getTimeout());
8282
$this->assertSame(5, $partialInput->getRetries());
8383
// timeout came from the branch default; only the user-supplied retries is in raw input.
84-
$this->assertSame(['retries' => 5], $partialInput->getRawModelDataInput());
84+
$this->assertSame(['retries' => 5], $partialInput->meta()->rawInput());
8585
}
8686

8787
/**
@@ -111,11 +111,11 @@ public function testBranchesWithIdenticalDefaultsCollapseToSingleApplication(str
111111
$object = new $className([]);
112112
$this->assertSame(30, $object->getTimeout());
113113
// The agreed default came from branches, not the user; absent from raw input.
114-
$this->assertSame([], $object->getRawModelDataInput());
114+
$this->assertSame([], $object->meta()->rawInput());
115115

116116
// User-supplied value must override the agreed default.
117117
$withUserValue = new $className(['timeout' => 99]);
118118
$this->assertSame(99, $withUserValue->getTimeout());
119-
$this->assertSame(['timeout' => 99], $withUserValue->getRawModelDataInput());
119+
$this->assertSame(['timeout' => 99], $withUserValue->meta()->rawInput());
120120
}
121121
}

tests/ComposedValue/ComposedIfThenElseBranchDefaultTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,24 @@ public function testThenAndElseBranchDefaultsApplyForMatchingBranchOnly(): void
4141
$this->assertSame('default-a', $branchThen->getValue());
4242
$this->assertNull($branchThen->getTimeout());
4343
// value came from the then-branch default; absent from raw input.
44-
$this->assertSame(['kind' => 'A'], $branchThen->getRawModelDataInput());
44+
$this->assertSame(['kind' => 'A'], $branchThen->meta()->rawInput());
4545

4646
// kind=B → if condition does not match → else branch → timeout=60, value=null.
4747
$branchElse = new $className(['kind' => 'B']);
4848
$this->assertNull($branchElse->getValue());
4949
$this->assertSame(60, $branchElse->getTimeout());
5050
// timeout came from the else-branch default; absent from raw input.
51-
$this->assertSame(['kind' => 'B'], $branchElse->getRawModelDataInput());
51+
$this->assertSame(['kind' => 'B'], $branchElse->meta()->rawInput());
5252

5353
// User-supplied value overrides the then-branch default.
5454
$thenUserOverride = new $className(['kind' => 'A', 'value' => 'custom']);
5555
$this->assertSame('custom', $thenUserOverride->getValue());
56-
$this->assertSame(['kind' => 'A', 'value' => 'custom'], $thenUserOverride->getRawModelDataInput());
56+
$this->assertSame(['kind' => 'A', 'value' => 'custom'], $thenUserOverride->meta()->rawInput());
5757

5858
// User-supplied value overrides the else-branch default.
5959
$elseUserOverride = new $className(['kind' => 'B', 'timeout' => 5]);
6060
$this->assertSame(5, $elseUserOverride->getTimeout());
61-
$this->assertSame(['kind' => 'B', 'timeout' => 5], $elseUserOverride->getRawModelDataInput());
61+
$this->assertSame(['kind' => 'B', 'timeout' => 5], $elseUserOverride->meta()->rawInput());
6262
}
6363

6464
/**
@@ -79,13 +79,13 @@ public function testDifferingThenElseDefaultsForSamePropertyAreAllowed(): void
7979
$branchThen = new $className(['kind' => 'A']);
8080
$this->assertSame(10, $branchThen->getTimeout());
8181
// timeout came from the then-branch default; absent from raw input.
82-
$this->assertSame(['kind' => 'A'], $branchThen->getRawModelDataInput());
82+
$this->assertSame(['kind' => 'A'], $branchThen->meta()->rawInput());
8383

8484
// if condition does not match (kind=B) → else branch → timeout=60.
8585
$branchElse = new $className(['kind' => 'B']);
8686
$this->assertSame(60, $branchElse->getTimeout());
8787
// timeout came from the else-branch default; absent from raw input.
88-
$this->assertSame(['kind' => 'B'], $branchElse->getRawModelDataInput());
88+
$this->assertSame(['kind' => 'B'], $branchElse->meta()->rawInput());
8989
}
9090

9191
/**

tests/ComposedValue/ComposedOneOfBranchDefaultTest.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ public function testConstructionAppliesBranchDefaultOnlyForDeclaringBranch(): vo
3434
$branchA = new $className(['kind' => 'A']);
3535
$this->assertNull($branchA->getSandbox());
3636
// Branch default was not applied; sandbox is absent from raw input.
37-
$this->assertSame(['kind' => 'A'], $branchA->getRawModelDataInput());
37+
$this->assertSame(['kind' => 'A'], $branchA->meta()->rawInput());
3838

3939
// Branch 1 matches: sandbox default true is applied.
4040
$branchB = new $className(['kind' => 'B']);
4141
$this->assertTrue($branchB->getSandbox());
4242
// Default came from the branch, not the user; sandbox is absent from raw input.
43-
$this->assertSame(['kind' => 'B'], $branchB->getRawModelDataInput());
43+
$this->assertSame(['kind' => 'B'], $branchB->meta()->rawInput());
4444

4545
// Branch 1 matches, sandbox explicitly supplied: user value is preserved.
4646
$branchBExplicit = new $className(['kind' => 'B', 'sandbox' => false]);
4747
$this->assertFalse($branchBExplicit->getSandbox());
4848
// User supplied sandbox; it must appear in raw input.
49-
$this->assertSame(['kind' => 'B', 'sandbox' => false], $branchBExplicit->getRawModelDataInput());
49+
$this->assertSame(['kind' => 'B', 'sandbox' => false], $branchBExplicit->meta()->rawInput());
5050
}
5151

5252
/**
@@ -64,12 +64,12 @@ public function testSetterFlipFromNonDeclaringBranchToDeclaringBranchAppliesDefa
6464

6565
$object = new $className(['kind' => 'A']);
6666
$this->assertNull($object->getSandbox());
67-
$this->assertSame(['kind' => 'A'], $object->getRawModelDataInput());
67+
$this->assertSame(['kind' => 'A'], $object->meta()->rawInput());
6868

6969
$object->setKind('B');
7070
$this->assertTrue($object->getSandbox());
7171
// The setter only writes 'kind' into raw; the branch default for sandbox is not raw input.
72-
$this->assertSame(['kind' => 'B'], $object->getRawModelDataInput());
72+
$this->assertSame(['kind' => 'B'], $object->meta()->rawInput());
7373
}
7474

7575
/**
@@ -88,12 +88,12 @@ public function testSetterOnUnrelatedPropertyPreservesExplicitBranchDefaultValue
8888

8989
$object = new $className(['kind' => 'B', 'sandbox' => false]);
9090
$this->assertFalse($object->getSandbox());
91-
$this->assertSame(['kind' => 'B', 'sandbox' => false], $object->getRawModelDataInput());
91+
$this->assertSame(['kind' => 'B', 'sandbox' => false], $object->meta()->rawInput());
9292

9393
$object->setNote('hello');
9494
$this->assertFalse($object->getSandbox());
9595
// After setting an unrelated property, the user-supplied sandbox is still in raw input.
96-
$this->assertSame(['kind' => 'B', 'sandbox' => false, 'note' => 'hello'], $object->getRawModelDataInput());
96+
$this->assertSame(['kind' => 'B', 'sandbox' => false, 'note' => 'hello'], $object->meta()->rawInput());
9797
}
9898

9999
/**
@@ -113,12 +113,12 @@ public function testSetterFlipFromDeclaringBranchToNonDeclaringBranchResetsDefau
113113
$object = new $className(['kind' => 'B']);
114114
$this->assertTrue($object->getSandbox());
115115
// sandbox came from the branch default; it must not be present in raw input.
116-
$this->assertSame(['kind' => 'B'], $object->getRawModelDataInput());
116+
$this->assertSame(['kind' => 'B'], $object->meta()->rawInput());
117117

118118
$object->setKind('A');
119119
$this->assertNull($object->getSandbox());
120120
// After the branch flip, sandbox is still absent from raw input.
121-
$this->assertSame(['kind' => 'A'], $object->getRawModelDataInput());
121+
$this->assertSame(['kind' => 'A'], $object->meta()->rawInput());
122122
}
123123

124124
/**
@@ -142,14 +142,14 @@ public function testSetterFlipToNonDeclaringBranchPreservesUserSuppliedValue():
142142
// User explicitly supplies sandbox=false (overriding the branch-1 default of true).
143143
$object = new $className(['kind' => 'B', 'sandbox' => false]);
144144
$this->assertFalse($object->getSandbox());
145-
$this->assertSame(['kind' => 'B', 'sandbox' => false], $object->getRawModelDataInput());
145+
$this->assertSame(['kind' => 'B', 'sandbox' => false], $object->meta()->rawInput());
146146

147147
// Switch to branch 0: sandbox is not a branch-0 default, but was user-supplied,
148148
// so it remains in _rawModelDataInput and must NOT be reset to null.
149149
$object->setKind('A');
150150
$this->assertFalse($object->getSandbox());
151151
// The user-supplied sandbox survives the branch flip and remains in raw input.
152-
$this->assertSame(['kind' => 'A', 'sandbox' => false], $object->getRawModelDataInput());
152+
$this->assertSame(['kind' => 'A', 'sandbox' => false], $object->meta()->rawInput());
153153
}
154154

155155
/**
@@ -171,18 +171,18 @@ public function testOneOfAllowsDifferingDefaultsAcrossBranches(): void
171171
$branchA = new $className(['kind' => 'A']);
172172
$this->assertSame(10, $branchA->getTimeout());
173173
// Timeout came from the branch default; absent from raw input.
174-
$this->assertSame(['kind' => 'A'], $branchA->getRawModelDataInput());
174+
$this->assertSame(['kind' => 'A'], $branchA->meta()->rawInput());
175175

176176
// Branch B matches (kind=B): timeout=60.
177177
$branchB = new $className(['kind' => 'B']);
178178
$this->assertSame(60, $branchB->getTimeout());
179179
// Timeout came from the branch default; absent from raw input.
180-
$this->assertSame(['kind' => 'B'], $branchB->getRawModelDataInput());
180+
$this->assertSame(['kind' => 'B'], $branchB->meta()->rawInput());
181181

182182
// User-supplied value overrides the branch default in both cases.
183183
$branchAOverride = new $className(['kind' => 'A', 'timeout' => 99]);
184184
$this->assertSame(99, $branchAOverride->getTimeout());
185-
$this->assertSame(['kind' => 'A', 'timeout' => 99], $branchAOverride->getRawModelDataInput());
185+
$this->assertSame(['kind' => 'A', 'timeout' => 99], $branchAOverride->meta()->rawInput());
186186
}
187187

188188
/**
@@ -205,15 +205,15 @@ public function testPopulateTransitionsBetweenBranchesApplyAndRemoveBranchDefaul
205205

206206
$object = new $className(['kind' => 'A']);
207207
$this->assertNull($object->getSandbox());
208-
$this->assertSame(['kind' => 'A'], $object->getRawModelDataInput());
208+
$this->assertSame(['kind' => 'A'], $object->meta()->rawInput());
209209

210210
$object->populate(['kind' => 'B']);
211211
$this->assertTrue($object->getSandbox());
212212
// populate() merges its input into raw; sandbox came from the branch default, not from populate().
213-
$this->assertSame(['kind' => 'B'], $object->getRawModelDataInput());
213+
$this->assertSame(['kind' => 'B'], $object->meta()->rawInput());
214214

215215
$object->populate(['kind' => 'A']);
216216
$this->assertNull($object->getSandbox());
217-
$this->assertSame(['kind' => 'A'], $object->getRawModelDataInput());
217+
$this->assertSame(['kind' => 'A'], $object->meta()->rawInput());
218218
}
219219
}

tests/ComposedValue/ComposedPatternPropertyBranchDefaultTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ public function testBranchDefaultAppliesWhenPropertyAlsoMatchesRootPattern(): vo
4444
// Branch 0 matches (kind=A): retry_count has no default in branch 0 — must be null.
4545
$branchA = new $className(['kind' => 'A']);
4646
$this->assertNull($branchA->getRetryCount());
47-
$this->assertSame(['kind' => 'A'], $branchA->getRawModelDataInput());
47+
$this->assertSame(['kind' => 'A'], $branchA->meta()->rawInput());
4848

4949
// Branch 1 matches (kind=B): branch default 3 applies.
5050
$branchB = new $className(['kind' => 'B']);
5151
$this->assertSame(3, $branchB->getRetryCount());
5252
// Default came from the branch; absent from raw input.
53-
$this->assertSame(['kind' => 'B'], $branchB->getRawModelDataInput());
53+
$this->assertSame(['kind' => 'B'], $branchB->meta()->rawInput());
5454

5555
// User-supplied value overrides the branch default.
5656
$branchBExplicit = new $className(['kind' => 'B', 'retry_count' => 5]);
5757
$this->assertSame(5, $branchBExplicit->getRetryCount());
58-
$this->assertSame(['kind' => 'B', 'retry_count' => 5], $branchBExplicit->getRawModelDataInput());
58+
$this->assertSame(['kind' => 'B', 'retry_count' => 5], $branchBExplicit->meta()->rawInput());
5959
}
6060

6161
/**
@@ -96,25 +96,25 @@ public function testPatternDefaultPropagatedToBranchPropertyWhenNoExplicitBranch
9696
// Branch 0 matches (kind=A): no retry_count in this branch — must be null.
9797
$branchA = new $className(['kind' => 'A']);
9898
$this->assertNull($branchA->getRetryCount());
99-
$this->assertSame(['kind' => 'A'], $branchA->getRawModelDataInput());
99+
$this->assertSame(['kind' => 'A'], $branchA->meta()->rawInput());
100100

101101
// Branch 1 matches (kind=B): pattern default 3 is propagated to the branch property.
102102
$branchB = new $className(['kind' => 'B']);
103103
$this->assertSame(3, $branchB->getRetryCount());
104104
// Default came from the pattern (via branch propagation); absent from raw input.
105-
$this->assertSame(['kind' => 'B'], $branchB->getRawModelDataInput());
105+
$this->assertSame(['kind' => 'B'], $branchB->meta()->rawInput());
106106

107107
// User-supplied value overrides the propagated pattern default.
108108
$branchBExplicit = new $className(['kind' => 'B', 'retry_count' => 7]);
109109
$this->assertSame(7, $branchBExplicit->getRetryCount());
110-
$this->assertSame(['kind' => 'B', 'retry_count' => 7], $branchBExplicit->getRawModelDataInput());
110+
$this->assertSame(['kind' => 'B', 'retry_count' => 7], $branchBExplicit->meta()->rawInput());
111111

112112
// Switching branches removes the pattern-propagated default (no default in branch 0).
113113
$object = new $className(['kind' => 'B']);
114114
$this->assertSame(3, $object->getRetryCount());
115115
$object->setKind('A');
116116
$this->assertNull($object->getRetryCount());
117-
$this->assertSame(['kind' => 'A'], $object->getRawModelDataInput());
117+
$this->assertSame(['kind' => 'A'], $object->meta()->rawInput());
118118
}
119119

120120
/**
@@ -133,12 +133,12 @@ public function testPatternDefaultPropagatedToRootProperty(): void
133133
// No user input: pattern default 3 applied to root property.
134134
$noInput = new $className([]);
135135
$this->assertSame(3, $noInput->getRetryCount());
136-
$this->assertSame([], $noInput->getRawModelDataInput());
136+
$this->assertSame([], $noInput->meta()->rawInput());
137137

138138
// User-supplied value overrides the pattern-propagated root default.
139139
$withValue = new $className(['retry_count' => 7]);
140140
$this->assertSame(7, $withValue->getRetryCount());
141-
$this->assertSame(['retry_count' => 7], $withValue->getRawModelDataInput());
141+
$this->assertSame(['retry_count' => 7], $withValue->meta()->rawInput());
142142
}
143143

144144
/**
@@ -189,7 +189,7 @@ public function testPatternDefaultAgreesWithBranchDefaultNoConflict(): void
189189
// Branch 1 (kind=B): branch default 3 applies (same as the pattern default — they agree).
190190
$branchB = new $className(['kind' => 'B']);
191191
$this->assertSame(3, $branchB->getRetryCount());
192-
$this->assertSame(['kind' => 'B'], $branchB->getRawModelDataInput());
192+
$this->assertSame(['kind' => 'B'], $branchB->meta()->rawInput());
193193

194194
// Branch 0 (kind=A): retry_count not in branch 0 — null.
195195
$branchA = new $className(['kind' => 'A']);

0 commit comments

Comments
 (0)