diff --git a/src/Mixins/Expectation.php b/src/Mixins/Expectation.php index 71117657..ffaeea30 100644 --- a/src/Mixins/Expectation.php +++ b/src/Mixins/Expectation.php @@ -467,6 +467,18 @@ final class Expectation return $this; } + /** + * Asserts that the value is a list. + * + * @return self + */ + public function toBeList(string $message = ''): self + { + Assert::assertIsList($this->value, $message); + + return $this; + } + /** * Asserts that the value is of type bool. * diff --git a/src/Pest.php b/src/Pest.php index fb049a7a..e53afa26 100644 --- a/src/Pest.php +++ b/src/Pest.php @@ -6,7 +6,7 @@ namespace Pest; function version(): string { - return '3.0.0-dev-0007'; + return '3.0.0-dev-0008'; } function testDirectory(string $file = ''): string diff --git a/stubs/init-laravel/TestCase.php.stub b/stubs/init-laravel/TestCase.php.stub index 2932d4a6..fe1ffc2f 100644 --- a/stubs/init-laravel/TestCase.php.stub +++ b/stubs/init-laravel/TestCase.php.stub @@ -6,5 +6,5 @@ use Illuminate\Foundation\Testing\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase { - use CreatesApplication; + // } diff --git a/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap b/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap index 78e2c52a..15e52032 100644 --- a/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap +++ b/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap @@ -1,5 +1,5 @@ - Pest Testing Framework 3.0.0-dev-0007. + Pest Testing Framework 3.0.0-dev-0008. USAGE: pest [options] diff --git a/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap b/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap index c92286d5..1dfa5f19 100644 --- a/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap +++ b/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap @@ -1,3 +1,3 @@ - Pest Testing Framework 3.0.0-dev-0007. + Pest Testing Framework 3.0.0-dev-0008. diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index e13630e6..f546c495 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -525,6 +525,12 @@ ✓ passes with strings ✓ failures ✓ failures with custom message + ✓ not failures + + PASS Tests\Features\Expect\toBeList + ✓ pass + ✓ failures + ✓ failures with custom message ✓ not failures PASS Tests\Features\Expect\toBeLowercase @@ -1463,4 +1469,4 @@ WARN Tests\Visual\Version - visual snapshot of help command output - Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 24 skipped, 1044 passed (2565 assertions) \ No newline at end of file + Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 24 skipped, 1046 passed (2573 assertions) diff --git a/tests/Features/Expect/toBeList.php b/tests/Features/Expect/toBeList.php new file mode 100644 index 00000000..095fda9d --- /dev/null +++ b/tests/Features/Expect/toBeList.php @@ -0,0 +1,21 @@ +toBeList(); + expect(['a' => 1, 'b' => 2, 'c' => 3])->not->toBeList(); + expect('1, 2, 3')->not->toBeList(); +}); + +test('failures', function () { + expect(null)->toBeList(); +})->throws(ExpectationFailedException::class); + +test('failures with custom message', function () { + expect(null)->toBeList('oh no!'); +})->throws(ExpectationFailedException::class, 'oh no!'); + +test('not failures', function () { + expect(['a', 'b', 'c'])->not->toBeList(); +})->throws(ExpectationFailedException::class); diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index cdc756c4..bea67aea 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: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 1030 passed (2533 assertions)') + ->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 1032 passed (2541 assertions)') ->toContain('Parallel: 3 processes'); })->skipOnWindows();