From 453580991643cc3cc325b3b84ddfe70b6d7b6761 Mon Sep 17 00:00:00 2001 From: Jason Adams Date: Wed, 31 May 2023 16:42:58 -0700 Subject: [PATCH 1/2] Feature: add boolean rule (#12) --- src/Rules/Boolean.php | 63 ++++++++++++++++++++++++++++++++ src/ServiceProvider.php | 2 + tests/unit/Rules/BooleanTest.php | 60 ++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 src/Rules/Boolean.php create mode 100644 tests/unit/Rules/BooleanTest.php diff --git a/src/Rules/Boolean.php b/src/Rules/Boolean.php new file mode 100644 index 0000000..7339aba --- /dev/null +++ b/src/Rules/Boolean.php @@ -0,0 +1,63 @@ +sanitize('1')); + self::assertSame(false, $rule->sanitize('0')); + } +} From 33704b529a4514b26db7a8fabc3f42b59a10162a Mon Sep 17 00:00:00 2001 From: Jason Adams Date: Wed, 31 May 2023 16:44:44 -0700 Subject: [PATCH 2/2] chore: prepare for 1.4.0 release --- src/Rules/Boolean.php | 10 +++++----- tests/unit/Rules/BooleanTest.php | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Rules/Boolean.php b/src/Rules/Boolean.php index 7339aba..c6dcd0c 100644 --- a/src/Rules/Boolean.php +++ b/src/Rules/Boolean.php @@ -12,7 +12,7 @@ class Boolean implements ValidationRule, ValidatesOnFrontEnd, Sanitizer /** * {@inheritDoc} * - * @unreleased + * @since 1.4.0 */ public static function id(): string { @@ -22,7 +22,7 @@ public static function id(): string /** * {@inheritDoc} * - * @unreleased + * @since 1.4.0 */ public static function fromString(string $options = null): ValidationRule { @@ -32,7 +32,7 @@ public static function fromString(string $options = null): ValidationRule /** * {@inheritDoc} * - * @unreleased + * @since 1.4.0 */ public function __invoke($value, Closure $fail, string $key, array $values) { @@ -44,7 +44,7 @@ public function __invoke($value, Closure $fail, string $key, array $values) /** * {@inheritDoc} * - * @unreleased + * @since 1.4.0 */ public function serializeOption() { @@ -54,7 +54,7 @@ public function serializeOption() /** * {@inheritDoc} * - * @unreleased + * @since 1.4.0 */ public function sanitize($value) { diff --git a/tests/unit/Rules/BooleanTest.php b/tests/unit/Rules/BooleanTest.php index dbf5cee..9ede234 100644 --- a/tests/unit/Rules/BooleanTest.php +++ b/tests/unit/Rules/BooleanTest.php @@ -8,7 +8,7 @@ class BooleanTest extends TestCase { /** - * @unreleased + * @since 1.4.0 * * @dataProvider booleansProvider */ @@ -24,7 +24,7 @@ public function testRuleValidatesBooleans($value, $pass) } /** - * @unreleased + * @since 1.4.0 */ public function booleansProvider(): array { @@ -49,7 +49,7 @@ public function booleansProvider(): array } /** - * @unreleased + * @since 1.4.0 */ public function testCastsToBoolean() {