Skip to content

Commit ee50f4d

Browse files
committed
Add a test to assoc schema, which would not be possible with object schema
1 parent 68fd013 commit ee50f4d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/Unit/Schema/AssocSchemaTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,19 @@ public function testParseSuccessWithJsonSerialzableObject(): void
133133
self::assertSame((array) $input, $output);
134134
}
135135

136+
public function testParseSuccessWithNumberAtTheBeginningOfTheString(): void
137+
{
138+
$input = ['1field' => 'test', '2field' => 1];
139+
140+
$schema = new AssocSchema(['1field' => new StringSchema(), '2field' => new IntSchema()]);
141+
142+
$output = $schema->parse([...$input, 'field3' => 1.5]);
143+
144+
self::assertIsArray($output);
145+
146+
self::assertSame($input, $output);
147+
}
148+
136149
public function testParseSuccessWithOptional(): void
137150
{
138151
$input = ['field2' => 'test', 'field3' => null];

0 commit comments

Comments
 (0)