PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
give / vendor / vendor-prefixed / stellarwp / validation / tests / unit / Rules / NumericTest.php

NumericTest.php in GiveWP – Donation Plugin and Fundraising Platform 4.17.0, at vendor/vendor-prefixed/stellarwp/validation/tests/unit/Rules/NumericTest.php

42 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Give\Vendors\StellarWP\Validation\Tests\Unit\Rules;
6
7 use Give\Vendors\StellarWP\Validation\Rules\Numeric;
8 use Give\Vendors\StellarWP\Validation\Tests\TestCase;
9 class NumericTest extends TestCase
10 {
11 /**
12 * @since 1.1.0
13 */
14 public function testShouldPassWhenValueIsNumeric()
15 {
16 $rule = new Numeric();
17
18 self::assertValidationRulePassed($rule, 1);
19 self::assertValidationRulePassed($rule, 100.00);
20 self::assertValidationRulePassed($rule, '1');
21 self::assertValidationRulePassed($rule, '100.00');
22 }
23
24 /**
25 * @since 1.1.0
26 */
27 public function testShouldFailWhenValueIsNotNumeric()
28 {
29 $rule = new Numeric();
30
31 self::assertValidationRuleFailed($rule, 'abc');
32 self::assertValidationRuleFailed($rule, 'abc123');
33 self::assertValidationRuleFailed($rule, '123abc');
34 self::assertValidationRuleFailed($rule, '123.abc');
35 self::assertValidationRuleFailed($rule, '123.345.56');
36 self::assertValidationRuleFailed($rule, 'abc.123');
37 self::assertValidationRuleFailed($rule, 'abc123.abc');
38 self::assertValidationRuleFailed($rule, 'abc.123abc');
39 self::assertValidationRuleFailed($rule, 'abc123.abc456');
40 }
41 }
42