From 398e3ff3b526c8725e9a6d1c223c4e2802613364 Mon Sep 17 00:00:00 2001 From: AJ Meireles Date: Mon, 14 Aug 2023 17:10:58 -0300 Subject: [PATCH 1/4] introducing toBeDigits --- src/Mixins/Expectation.php | 12 ++++++++++++ tests/Features/Expect/toBeDigits.php | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 tests/Features/Expect/toBeDigits.php diff --git a/src/Mixins/Expectation.php b/src/Mixins/Expectation.php index 56e1da09..cb3ec31d 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/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); From 7914224ff7420fa2da7097116656cc9e8089d055 Mon Sep 17 00:00:00 2001 From: AJ Meireles Date: Thu, 17 Aug 2023 15:50:15 -0300 Subject: [PATCH 2/4] introducing https://schema.phpunit.de/10.3/phpunit.xsd --- stubs/init-laravel/phpunit.xml.stub | 2 +- stubs/init/phpunit.xml.stub | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 @@ From d218afaf777b84fbc9b176b0ffd8aaf776f90b9f Mon Sep 17 00:00:00 2001 From: AJ Meireles Date: Thu, 17 Aug 2023 18:50:23 -0300 Subject: [PATCH 3/4] introducing new proposal of the PR template --- .github/PULL_REQUEST_TEMPLATE.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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: + + From 2f90d4ccd7be0b9920ed64f16c4b0c25165e178c Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 18 Aug 2023 12:16:15 +0100 Subject: [PATCH 4/4] tests: update snapshots --- tests/.snapshots/success.txt | 8 +++++++- tests/Visual/Parallel.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) 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/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();