|
9 | 9 | use Chubbyphp\Parsing\Schema\AbstractSchemaInnerParse; |
10 | 10 | use PHPUnit\Framework\TestCase; |
11 | 11 |
|
12 | | -enum AbstractSchemaInnerParseEnum: string |
13 | | -{ |
14 | | - case Hearts = 'H'; |
15 | | - case Diamonds = 'D'; |
16 | | - case Clubs = 'C'; |
17 | | - case Spades = 'S'; |
18 | | -} |
19 | | - |
20 | 12 | /** |
21 | 13 | * @covers \Chubbyphp\Parsing\Schema\AbstractSchemaInnerParse |
22 | 14 | * |
@@ -154,66 +146,4 @@ protected function innerParse(mixed $input): mixed |
154 | 146 | self::assertSame(\stdClass::class, $e->errors->jsonSerialize()[0]['error']['variables']['given']); |
155 | 147 | } |
156 | 148 | } |
157 | | - |
158 | | - public function testVarExport(): void |
159 | | - { |
160 | | - $schema = new class extends AbstractSchemaInnerParse { |
161 | | - protected function innerParse(mixed $input): string |
162 | | - { |
163 | | - return $this->varExport($input); |
164 | | - } |
165 | | - }; |
166 | | - |
167 | | - self::assertSame('null', $schema->parse(null)); |
168 | | - self::assertSame('true', $schema->parse(true)); |
169 | | - self::assertSame('false', $schema->parse(false)); |
170 | | - self::assertSame('1', $schema->parse(1)); |
171 | | - self::assertSame('1.234', $schema->parse(1.234)); |
172 | | - self::assertSame('1200.0', $schema->parse(1.2e3)); |
173 | | - self::assertSame('7.0E-10', $schema->parse(7E-10)); |
174 | | - self::assertSame('1234.567', $schema->parse(1_234.567)); |
175 | | - self::assertSame("'test'", $schema->parse('test')); |
176 | | - self::assertSame( |
177 | | - "new \\DateTimeImmutable('2024-01-20T09:15:00+00:00')", |
178 | | - $schema->parse(new \DateTimeImmutable('2024-01-20T09:15:00+00:00')) |
179 | | - ); |
180 | | - self::assertSame( |
181 | | - '\Chubbyphp\Tests\Parsing\Unit\Schema\AbstractSchemaInnerParseEnum::from(\'H\')', |
182 | | - $schema->parse(AbstractSchemaInnerParseEnum::Hearts) |
183 | | - ); |
184 | | - |
185 | | - self::assertSame( |
186 | | - "['null' => null, 'true' => true, 'false' => 'false', 1 => 1, '1.234' => 1.234, '1.2e3' => 1200.0, '7E-10' => 7.0E-10, '1_234.567' => 1234.567, 'test' => 'test', '2024-01-20T09:15:00+00:00' => new \\DateTimeImmutable('2024-01-20T09:15:00+00:00'), 'AbstractSchemaInnerParseEnum::Hearts' => \\Chubbyphp\\Tests\\Parsing\\Unit\\Schema\\AbstractSchemaInnerParseEnum::from('H')]", |
187 | | - $schema->parse([ |
188 | | - 'null' => null, |
189 | | - 'true' => true, |
190 | | - 'false' => 'false', |
191 | | - '1' => 1, |
192 | | - '1.234' => 1.234, |
193 | | - '1.2e3' => 1.2e3, |
194 | | - '7E-10' => 7E-10, |
195 | | - '1_234.567' => 1_234.567, |
196 | | - 'test' => 'test', |
197 | | - '2024-01-20T09:15:00+00:00' => new \DateTimeImmutable('2024-01-20T09:15:00+00:00'), |
198 | | - 'AbstractSchemaInnerParseEnum::Hearts' => AbstractSchemaInnerParseEnum::Hearts, |
199 | | - ]) |
200 | | - ); |
201 | | - |
202 | | - self::assertSame( |
203 | | - "(object) ['null' => null, 'true' => true, 'false' => 'false', 1 => 1, '1.234' => 1.234, '1.2e3' => 1200.0, '7E-10' => 7.0E-10, '1_234.567' => 1234.567, 'test' => 'test', '2024-01-20T09:15:00+00:00' => new \\DateTimeImmutable('2024-01-20T09:15:00+00:00'), 'AbstractSchemaInnerParseEnum::Hearts' => \\Chubbyphp\\Tests\\Parsing\\Unit\\Schema\\AbstractSchemaInnerParseEnum::from('H')]", |
204 | | - $schema->parse((object) [ |
205 | | - 'null' => null, |
206 | | - 'true' => true, |
207 | | - 'false' => 'false', |
208 | | - '1' => 1, |
209 | | - '1.234' => 1.234, |
210 | | - '1.2e3' => 1.2e3, |
211 | | - '7E-10' => 7E-10, |
212 | | - '1_234.567' => 1_234.567, |
213 | | - 'test' => 'test', |
214 | | - '2024-01-20T09:15:00+00:00' => new \DateTimeImmutable('2024-01-20T09:15:00+00:00'), |
215 | | - 'AbstractSchemaInnerParseEnum::Hearts' => AbstractSchemaInnerParseEnum::Hearts, |
216 | | - ]) |
217 | | - ); |
218 | | - } |
219 | 149 | } |
0 commit comments