mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
test: add new exception check & update snapshots
This commit is contained in:
@ -527,6 +527,7 @@
|
|||||||
|
|
||||||
PASS Tests\Unit\TestSuite
|
PASS Tests\Unit\TestSuite
|
||||||
✓ it does not allow to add the same test description twice
|
✓ 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
|
PASS Tests\Visual\Help
|
||||||
✓ visual snapshot of help command output
|
✓ visual snapshot of help command output
|
||||||
@ -554,5 +555,5 @@
|
|||||||
✓ it is a test
|
✓ it is a test
|
||||||
✓ it uses correct parent class
|
✓ it uses correct parent class
|
||||||
|
|
||||||
Tests: 4 incompleted, 7 skipped, 340 passed
|
Tests: 4 incompleted, 7 skipped, 341 passed
|
||||||
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Pest\Exceptions\DatasetMissing;
|
||||||
use Pest\Exceptions\TestAlreadyExist;
|
use Pest\Exceptions\TestAlreadyExist;
|
||||||
use Pest\TestSuite;
|
use Pest\TestSuite;
|
||||||
|
|
||||||
@ -11,3 +12,11 @@ it('does not allow to add the same test description twice', function () {
|
|||||||
$this->expectExceptionMessage(sprintf('A test with the description `%s` already exist in the filename `%s`.', 'foo', __FILE__));
|
$this->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));
|
$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));
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user