diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 6b729631..742d2bc8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,16 @@ -| Q | A -| ------------- | --- -| Bug fix? | yes/no -| New feature? | yes/no -| Fixed tickets | #... - +### What: + +- [ ] Bug Fix +- [ ] New Feature + +### Description: + + + +### Related: + + diff --git a/src/Mixins/Expectation.php b/src/Mixins/Expectation.php index 74cd066a..6b69014b 100644 --- a/src/Mixins/Expectation.php +++ b/src/Mixins/Expectation.php @@ -502,6 +502,18 @@ final class Expectation return $this; } + /** + * Asserts that the value contains only digits. + * + * @return self + */ + public function toBeDigits(string $message = ''): self + { + Assert::assertTrue(ctype_digit((string) $this->value), $message); + + return $this; + } + /** * Asserts that the value is of type object. * diff --git a/stubs/init-laravel/phpunit.xml.stub b/stubs/init-laravel/phpunit.xml.stub index eb13aff1..9ce6b780 100644 --- a/stubs/init-laravel/phpunit.xml.stub +++ b/stubs/init-laravel/phpunit.xml.stub @@ -1,6 +1,6 @@ diff --git a/stubs/init/phpunit.xml.stub b/stubs/init/phpunit.xml.stub index ada83de9..70a8572e 100644 --- a/stubs/init/phpunit.xml.stub +++ b/stubs/init/phpunit.xml.stub @@ -1,6 +1,6 @@ diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 48310246..3d4f0a6d 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -338,6 +338,12 @@ ✓ pass ✓ failures ✓ failures with custom message + ✓ not failures + + PASS Tests\Features\Expect\toBeDigits + ✓ pass + ✓ failures + ✓ failures with custom message ✓ not failures PASS Tests\Features\Expect\toBeDirectory @@ -1240,4 +1246,4 @@ WARN Tests\Visual\Version - visual snapshot of help command output - Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 878 passed (2013 assertions) \ No newline at end of file + Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 882 passed (2022 assertions) \ No newline at end of file diff --git a/tests/Features/Expect/toBeDigits.php b/tests/Features/Expect/toBeDigits.php new file mode 100644 index 00000000..7b8d6d98 --- /dev/null +++ b/tests/Features/Expect/toBeDigits.php @@ -0,0 +1,20 @@ +toBeDigits(); + expect('123.14')->not->toBeDigits(); +}); + +test('failures', function () { + expect('123.14')->toBeDigits(); +})->throws(ExpectationFailedException::class); + +test('failures with custom message', function () { + expect('123.14')->toBeDigits('oh no!'); +})->throws(ExpectationFailedException::class, 'oh no!'); + +test('not failures', function () { + expect('445')->not->toBeDigits(); +})->throws(ExpectationFailedException::class); diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index 84d89a0d..05c1c410 100644 --- a/tests/Visual/Parallel.php +++ b/tests/Visual/Parallel.php @@ -16,7 +16,7 @@ $run = function () { test('parallel', function () use ($run) { expect($run('--exclude-group=integration')) - ->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 15 skipped, 867 passed (1998 assertions)') + ->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 15 skipped, 871 passed (2007 assertions)') ->toContain('Parallel: 3 processes'); })->skipOnWindows();