Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit cd6ba3e

Browse files
committed
chore(unrelated): improved NotBlank tests
1 parent 0f59640 commit cd6ba3e

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

tests/NotBlankTest.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,28 @@ class NotBlankTest extends AbstractTest
1111
{
1212
use FormatValueTrait;
1313

14-
#[DataProvider('provideInvalidValueData')]
15-
public function testNotBlankInvalidValue(mixed $value)
14+
#[DataProvider('provideFailureConditionData')]
15+
public function testNotBlankFailureCondition(mixed $value)
1616
{
1717
$validator = Validator::notBlank();
1818

1919
$this->assertFalse($validator->validate($value));
2020

2121
$this->expectException(NotBlankException::class);
22-
$this->expectExceptionMessage(
23-
\sprintf('The "test" value should not be blank, "%s" given.', $this->formatValue($value))
24-
);
22+
$this->expectExceptionMessage(\sprintf('The "test" value should not be blank, "%s" given.', $this->formatValue($value)));
2523
$validator->assert($value, 'test');
2624
}
2725

28-
public static function provideInvalidValueData(): \Generator
26+
public static function provideFailureConditionData(): \Generator
2927
{
3028
yield 'null' => [null];
3129
yield 'false' => [false];
3230
yield 'blank string' => [''];
3331
yield 'blank array' => [[]];
3432
}
3533

36-
#[DataProvider('provideValidValueData')]
37-
public function testNotBlankValidValue(mixed $value)
34+
#[DataProvider('provideSuccessConditionData')]
35+
public function testNotBlankSuccessCondition(mixed $value)
3836
{
3937
$validator = Validator::notBlank();
4038

@@ -43,7 +41,7 @@ public function testNotBlankValidValue(mixed $value)
4341
$validator->assert($value, 'test');
4442
}
4543

46-
public static function provideValidValueData(): \Generator
44+
public static function provideSuccessConditionData(): \Generator
4745
{
4846
yield 'true' => [true];
4947

@@ -60,12 +58,12 @@ public static function provideValidValueData(): \Generator
6058
yield 'zero number' => [0];
6159
}
6260

63-
public function testNotBlankExceptionMessageParameters()
61+
public function testNotBlankMessageArgument()
6462
{
65-
$this->expectExceptionMessage('The "test" value "false" is invalid. Must not be blank.');
63+
$this->expectExceptionMessage('The "test" value "" is invalid. Must not be blank.');
6664

6765
Validator
6866
::notBlank(message: 'The "{{ name }}" value "{{ value }}" is invalid. Must not be blank.')
69-
->assert(false, 'test');
67+
->assert('', 'test');
7068
}
7169
}

0 commit comments

Comments
 (0)