Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions tests/Rule/Date/DateTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use DateTimeImmutable;
use DateTimeZone;
use Yiisoft\Validator\Rule\Date\DateTime;
use Yiisoft\Validator\Rule\Date\Date;
use Yiisoft\Validator\Rule\Date\DateTimeHandler;
use Yiisoft\Validator\Tests\Rule\Base\RuleTestCase;
use Yiisoft\Validator\Tests\Rule\Base\SkipOnErrorTestTrait;
Expand All @@ -20,7 +19,7 @@ final class DateTimeTest extends RuleTestCase

public function testGetName(): void
{
$rule = new Date();
$rule = new DateTime();
$this->assertSame('date', $rule->getName());
}

Expand Down Expand Up @@ -97,14 +96,14 @@ public static function dataValidationFailed(): array

public function testSkipOnError(): void
{
$this->testSkipOnErrorInternal(new Date(), new Date(skipOnError: true));
$this->testSkipOnErrorInternal(new DateTime(), new DateTime(skipOnError: true));
}

public function testWhen(): void
{
$this->testWhenInternal(
new Date(),
new Date(
new DateTime(),
new DateTime(
when: static fn(mixed $value): bool => $value !== null,
),
);
Expand Down
9 changes: 4 additions & 5 deletions tests/Rule/Date/TimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use DateTimeZone;
use IntlDateFormatter;
use Yiisoft\Validator\Rule\Date\Time;
use Yiisoft\Validator\Rule\Date\Date;
use Yiisoft\Validator\Rule\Date\TimeHandler;
use Yiisoft\Validator\Tests\Rule\Base\RuleTestCase;
use Yiisoft\Validator\Tests\Rule\Base\SkipOnErrorTestTrait;
Expand All @@ -21,7 +20,7 @@ final class TimeTest extends RuleTestCase

public function testGetName(): void
{
$rule = new Date();
$rule = new Time();
$this->assertSame('date', $rule->getName());
}

Expand Down Expand Up @@ -98,14 +97,14 @@ public static function dataValidationFailed(): array

public function testSkipOnError(): void
{
$this->testSkipOnErrorInternal(new Date(), new Date(skipOnError: true));
$this->testSkipOnErrorInternal(new Time(), new Time(skipOnError: true));
}

public function testWhen(): void
{
$this->testWhenInternal(
new Date(),
new Date(
new Time(),
new Time(
when: static fn(mixed $value): bool => $value !== null,
),
);
Expand Down
17 changes: 17 additions & 0 deletions tests/Rule/NumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public function testGetName(): void
$this->assertSame(Number::class, $rule->getName());
}

public function testIntegerGetName(): void
{
$rule = new Integer();
$this->assertSame(Integer::class, $rule->getName());
}

public static function dataOptions(): array
{
return [
Expand Down Expand Up @@ -312,9 +318,20 @@ public function testSkipOnError(): void
$this->testSkipOnErrorInternal(new Number(), new Number(skipOnError: true));
}

public function testIntegerSkipOnError(): void
{
$this->testSkipOnErrorInternal(new Integer(), new Integer(skipOnError: true));
}

public function testWhen(): void
{
$when = static fn(mixed $value): bool => $value !== null;
$this->testWhenInternal(new Number(), new Number(when: $when));
}

public function testIntegerWhen(): void
{
$when = static fn(mixed $value): bool => $value !== null;
$this->testWhenInternal(new Integer(), new Integer(when: $when));
}
}
Loading