diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 9f57d4fa..6328d9a5 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -527,6 +527,7 @@ PASS Tests\Unit\TestSuite ✓ it does not allow to add the same test description twice + ✓ it alerts users about tests with arguments but no input PASS Tests\Visual\Help ✓ visual snapshot of help command output @@ -554,5 +555,5 @@ ✓ it is a test ✓ it uses correct parent class - Tests: 4 incompleted, 7 skipped, 340 passed + Tests: 4 incompleted, 7 skipped, 341 passed \ No newline at end of file diff --git a/tests/Unit/TestSuite.php b/tests/Unit/TestSuite.php index 74d9c092..c26149c8 100644 --- a/tests/Unit/TestSuite.php +++ b/tests/Unit/TestSuite.php @@ -1,5 +1,6 @@ expectExceptionMessage(sprintf('A test with the description `%s` already exist in the filename `%s`.', 'foo', __FILE__)); $testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test)); }); + +it('alerts users about tests with arguments but no input', function () { + $testSuite = new TestSuite(getcwd(), 'tests'); + $test = function (int $arg) {}; + $this->expectException(DatasetMissing::class); + $this->expectExceptionMessage(sprintf("A test with the description '%s' has %d argument(s) ([%s]) and no dataset(s) provided in %s", 'foo', 1, 'int $arg', __FILE__)); + $testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test)); +});