55namespace Tempest \Validation \Tests \Rules ;
66
77use PHPUnit \Framework \TestCase ;
8- use Tempest \Validation \Rules \Custom ;
8+ use Tempest \Validation \Rules \Closure ;
99
1010/**
1111 * @internal
1212 */
13- final class CustomTest extends TestCase
13+ final class ClosureTest extends TestCase
1414{
1515 public function test_closure_validation_passes (): void
1616 {
17- $ rule = new Custom (static fn (mixed $ value ): bool => str_contains ((string ) $ value , '@ ' ));
17+ $ rule = new Closure (static fn (mixed $ value ): bool => str_contains ((string ) $ value , '@ ' ));
1818 $ this ->
assertTrue (
$ rule->
isValid (
'[email protected] ' ));
1919 $ this ->
assertTrue (
$ rule->
isValid (
'[email protected] ' ));
2020 }
2121
2222 public function test_closure_validation_fails (): void
2323 {
24- $ rule = new Custom (static fn (mixed $ value ): bool => str_contains ((string ) $ value , '@ ' ));
24+ $ rule = new Closure (static fn (mixed $ value ): bool => str_contains ((string ) $ value , '@ ' ));
2525
2626 $ this ->assertFalse ($ rule ->isValid ('username ' ));
2727 $ this ->assertFalse ($ rule ->isValid ('example.com ' ));
2828 }
2929
3030 public function test_non_string_value_fails (): void
3131 {
32- $ rule = new Custom (static fn (mixed $ value ): bool => str_contains ((string ) $ value , '@ ' ));
32+ $ rule = new Closure (static fn (mixed $ value ): bool => str_contains ((string ) $ value , '@ ' ));
3333
3434 $ this ->assertFalse ($ rule ->isValid (12345 ));
3535 $ this ->assertFalse ($ rule ->isValid (null ));
@@ -40,6 +40,6 @@ public function test_static_closure_required(): void
4040 {
4141 $ this ->expectException (\InvalidArgumentException::class);
4242
43- new Custom (fn (mixed $ value ): bool => str_contains ((string ) $ value , '@ ' ));
43+ new Closure (fn (mixed $ value ): bool => str_contains ((string ) $ value , '@ ' ));
4444 }
4545}
0 commit comments