Skip to content

Commit 7749a8f

Browse files
committed
be more precise about deprecation testing
1 parent 98ea520 commit 7749a8f

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

tests/Unit/Schema/StringSchemaTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -556,13 +556,11 @@ public function testParseWithMatchWithInvalidPattern(): void
556556

557557
public function testParseWithValidMatch(): void
558558
{
559-
error_clear_last();
560-
561559
$input = 'aBcDeFg';
562560

563-
$schema = (new StringSchema())->match('/^[a-z]+$/i');
561+
error_clear_last();
564562

565-
self::assertSame($input, $schema->parse($input));
563+
$schema = (new StringSchema())->match('/^[a-z]+$/i');
566564

567565
$lastError = error_get_last();
568566

@@ -571,6 +569,8 @@ public function testParseWithValidMatch(): void
571569
self::assertSame(E_USER_DEPRECATED, $lastError['type']);
572570
self::assertArrayHasKey('message', $lastError);
573571
self::assertSame('Use pattern instead', $lastError['message']);
572+
573+
self::assertSame($input, $schema->parse($input));
574574
}
575575

576576
public function testParseWithInvalidMatch(): void
@@ -660,13 +660,11 @@ public function testParseWithRegexpWithInvalidPattern(): void
660660

661661
public function testParseWithValidRegexp(): void
662662
{
663-
error_clear_last();
664-
665663
$input = 'aBcDeFg';
666664

667-
$schema = (new StringSchema())->regexp('/^[a-z]+$/i');
665+
error_clear_last();
668666

669-
self::assertSame($input, $schema->parse($input));
667+
$schema = (new StringSchema())->regexp('/^[a-z]+$/i');
670668

671669
$lastError = error_get_last();
672670

@@ -675,6 +673,8 @@ public function testParseWithValidRegexp(): void
675673
self::assertSame(E_USER_DEPRECATED, $lastError['type']);
676674
self::assertArrayHasKey('message', $lastError);
677675
self::assertSame('Use pattern instead', $lastError['message']);
676+
677+
self::assertSame($input, $schema->parse($input));
678678
}
679679

680680
public function testParseWithInvalidRegexp(): void

0 commit comments

Comments
 (0)