mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
release: beta 1
This commit is contained in:
@ -25,12 +25,12 @@
|
|||||||
"pestphp/pest-plugin-arch": "^4.0.0",
|
"pestphp/pest-plugin-arch": "^4.0.0",
|
||||||
"pestphp/pest-plugin-mutate": "^4.0.0",
|
"pestphp/pest-plugin-mutate": "^4.0.0",
|
||||||
"pestphp/pest-plugin-profanity": "^4.0.0",
|
"pestphp/pest-plugin-profanity": "^4.0.0",
|
||||||
"phpunit/phpunit": "^12.2.7",
|
"phpunit/phpunit": "^12.3.0",
|
||||||
"symfony/process": "^7.3.0"
|
"symfony/process": "^7.3.0"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"filp/whoops": "<2.18.3",
|
"filp/whoops": "<2.18.3",
|
||||||
"phpunit/phpunit": ">12.2.7",
|
"phpunit/phpunit": ">12.3.0",
|
||||||
"sebastian/exporter": "<7.0.0",
|
"sebastian/exporter": "<7.0.0",
|
||||||
"webmozart/assert": "<1.11.0"
|
"webmozart/assert": "<1.11.0"
|
||||||
},
|
},
|
||||||
@ -58,7 +58,7 @@
|
|||||||
"pestphp/pest-dev-tools": "^4.0.0",
|
"pestphp/pest-dev-tools": "^4.0.0",
|
||||||
"pestphp/pest-plugin-browser": "^4.0.0",
|
"pestphp/pest-plugin-browser": "^4.0.0",
|
||||||
"pestphp/pest-plugin-type-coverage": "^4.0.0",
|
"pestphp/pest-plugin-type-coverage": "^4.0.0",
|
||||||
"psy/psysh": "^0.12.9"
|
"psy/psysh": "^0.12.10"
|
||||||
},
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
|
|||||||
@ -22,7 +22,7 @@ final class DatasetMissing extends BadFunctionCallException implements Exception
|
|||||||
public function __construct(string $file, string $name, array $arguments)
|
public function __construct(string $file, string $name, array $arguments)
|
||||||
{
|
{
|
||||||
parent::__construct(sprintf(
|
parent::__construct(sprintf(
|
||||||
"A test with the description '%s' has %d argument(s) ([%s]) and no dataset(s) provided in %s",
|
'A test with the description [%s] has [%d] argument(s) ([%s]) and no dataset(s) provided in [%s]',
|
||||||
$name,
|
$name,
|
||||||
count($arguments),
|
count($arguments),
|
||||||
implode(', ', array_map(static fn (string $arg, string $type): string => sprintf('%s $%s', $type, $arg), array_keys($arguments), $arguments)),
|
implode(', ', array_map(static fn (string $arg, string $type): string => sprintf('%s $%s', $type, $arg), array_keys($arguments), $arguments)),
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Pest\Factories\Covers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
final class CoversNothing {}
|
|
||||||
@ -658,19 +658,6 @@ final class TestCall // @phpstan-ignore-line
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets that the current test covers nothing.
|
|
||||||
*/
|
|
||||||
public function coversNothing(): self
|
|
||||||
{
|
|
||||||
$this->testCaseMethod->attributes[] = new Attribute(
|
|
||||||
\PHPUnit\Framework\Attributes\CoversNothing::class,
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds one or more references to the tested method or class. This helps
|
* Adds one or more references to the tested method or class. This helps
|
||||||
* to link test cases to the source code for easier navigation.
|
* to link test cases to the source code for easier navigation.
|
||||||
|
|||||||
@ -6,7 +6,7 @@ namespace Pest;
|
|||||||
|
|
||||||
function version(): string
|
function version(): string
|
||||||
{
|
{
|
||||||
return '4.0.0-alpha.6';
|
return '4.0.0-beta.1';
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDirectory(string $file = ''): string
|
function testDirectory(string $file = ''): string
|
||||||
|
|||||||
@ -120,7 +120,7 @@ final class TestSuite
|
|||||||
assert($this->test instanceof TestCase);
|
assert($this->test instanceof TestCase);
|
||||||
|
|
||||||
$description = str_replace('__pest_evaluable_', '', $this->test->name());
|
$description = str_replace('__pest_evaluable_', '', $this->test->name());
|
||||||
$datasetAsString = str_replace('__pest_evaluable_', '', Str::evaluable($this->test->dataSetAsStringWithData()));
|
$datasetAsString = str_replace('__pest_evaluable_', '', Str::evaluable($this->test->dataSetAsString()));
|
||||||
|
|
||||||
return str_replace(' ', '_', $description.$datasetAsString);
|
return str_replace(' ', '_', $description.$datasetAsString);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ test('pass with dataset', function ($data) {
|
|||||||
[$filename] = TestSuite::getInstance()->snapshots->get();
|
[$filename] = TestSuite::getInstance()->snapshots->get();
|
||||||
|
|
||||||
expect($filename)->toStartWith('tests/.pest/snapshots-external/')
|
expect($filename)->toStartWith('tests/.pest/snapshots-external/')
|
||||||
->toEndWith('pass_with_dataset_with_data_set____my_datas_set_value______my_datas_set_value__.snap')
|
->toEndWith('pass_with_dataset_with_data_set_____my_datas_set_value___.snap')
|
||||||
->and($this->snapshotable)->toMatchSnapshot();
|
->and($this->snapshotable)->toMatchSnapshot();
|
||||||
})->with(['my-datas-set-value']);
|
})->with(['my-datas-set-value']);
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ describe('within describe', function () {
|
|||||||
[$filename] = TestSuite::getInstance()->snapshots->get();
|
[$filename] = TestSuite::getInstance()->snapshots->get();
|
||||||
|
|
||||||
expect($filename)->toStartWith('tests/.pest/snapshots-external/')
|
expect($filename)->toStartWith('tests/.pest/snapshots-external/')
|
||||||
->toEndWith('pass_with_dataset_with_data_set____my_datas_set_value______my_datas_set_value__.snap')
|
->toEndWith('pass_with_dataset_with_data_set_____my_datas_set_value___.snap')
|
||||||
->and($this->snapshotable)->toMatchSnapshot();
|
->and($this->snapshotable)->toMatchSnapshot();
|
||||||
});
|
});
|
||||||
})->with(['my-datas-set-value']);
|
})->with(['my-datas-set-value']);
|
||||||
|
|||||||
@ -0,0 +1,7 @@
|
|||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h1>Snapshot</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h1>Snapshot</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Pest Testing Framework 4.0.0-alpha.6.
|
Pest Testing Framework 4.0.0-beta.1.
|
||||||
|
|
||||||
USAGE: pest <file> [options]
|
USAGE: pest <file> [options]
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
|
|
||||||
Pest Testing Framework 4.0.0-alpha.6.
|
Pest Testing Framework 4.0.0-beta.1.
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
##teamcity[testStarted name='can also pass' locationHint='pest_qn://tests/.tests/SuccessOnly.php::can also pass' flowId='1234']
|
##teamcity[testStarted name='can also pass' locationHint='pest_qn://tests/.tests/SuccessOnly.php::can also pass' flowId='1234']
|
||||||
##teamcity[testFinished name='can also pass' duration='100000' flowId='1234']
|
##teamcity[testFinished name='can also pass' duration='100000' flowId='1234']
|
||||||
##teamcity[testSuiteStarted name='can pass with dataset' locationHint='pest_qn://tests/.tests/SuccessOnly.php::can pass with dataset' flowId='1234']
|
##teamcity[testSuiteStarted name='can pass with dataset' locationHint='pest_qn://tests/.tests/SuccessOnly.php::can pass with dataset' flowId='1234']
|
||||||
##teamcity[testStarted name='can pass with dataset with data set "(true)"' locationHint='pest_qn://tests/.tests/SuccessOnly.php::can pass with dataset with data set "(true)"' flowId='1234']
|
##teamcity[testStarted name='can pass with dataset with data set "@(true)"' locationHint='pest_qn://tests/.tests/SuccessOnly.php::can pass with dataset with data set "@(true)"' flowId='1234']
|
||||||
##teamcity[testFinished name='can pass with dataset with data set "(true)"' duration='100000' flowId='1234']
|
##teamcity[testFinished name='can pass with dataset with data set "@(true)"' duration='100000' flowId='1234']
|
||||||
##teamcity[testSuiteFinished name='can pass with dataset' flowId='1234']
|
##teamcity[testSuiteFinished name='can pass with dataset' flowId='1234']
|
||||||
##teamcity[testSuiteFinished name='Tests/tests/SuccessOnly' flowId='1234']
|
##teamcity[testSuiteFinished name='Tests/tests/SuccessOnly' flowId='1234']
|
||||||
|
|
||||||
|
|||||||
@ -83,9 +83,6 @@
|
|||||||
PASS Tests\Features\Covers\ClassCoverage
|
PASS Tests\Features\Covers\ClassCoverage
|
||||||
✓ it uses the correct PHPUnit attribute for class
|
✓ it uses the correct PHPUnit attribute for class
|
||||||
|
|
||||||
PASS Tests\Features\Covers\CoversNothing
|
|
||||||
✓ it uses the correct PHPUnit attribute for covers nothing
|
|
||||||
|
|
||||||
PASS Tests\Features\Covers\ExceptionHandling
|
PASS Tests\Features\Covers\ExceptionHandling
|
||||||
✓ it throws exception if no class nor method has been found
|
✓ it throws exception if no class nor method has been found
|
||||||
|
|
||||||
@ -1785,4 +1782,4 @@
|
|||||||
✓ pass with dataset with ('my-datas-set-value')
|
✓ pass with dataset with ('my-datas-set-value')
|
||||||
✓ within describe → pass with dataset with ('my-datas-set-value')
|
✓ within describe → pass with dataset with ('my-datas-set-value')
|
||||||
|
|
||||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 39 todos, 35 skipped, 1189 passed (2816 assertions)
|
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 39 todos, 35 skipped, 1188 passed (2814 assertions)
|
||||||
@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use PHPUnit\Framework\Attributes\CoversNothing;
|
|
||||||
|
|
||||||
it('uses the correct PHPUnit attribute for covers nothing', function () {
|
|
||||||
$attributes = (new ReflectionMethod($this, $this->name()))->getAttributes();
|
|
||||||
|
|
||||||
expect($attributes[2]->getName())->toBe(CoversNothing::class);
|
|
||||||
expect($attributes[2]->getArguments())->toHaveCount(0);
|
|
||||||
})->coversNothing();
|
|
||||||
@ -75,7 +75,7 @@ test('pass with dataset', function ($data) {
|
|||||||
[$filename] = TestSuite::getInstance()->snapshots->get();
|
[$filename] = TestSuite::getInstance()->snapshots->get();
|
||||||
|
|
||||||
expect($filename)->toStartWith('tests/.pest/snapshots/')
|
expect($filename)->toStartWith('tests/.pest/snapshots/')
|
||||||
->toEndWith('pass_with_dataset_with_data_set____my_datas_set_value______my_datas_set_value__.snap')
|
->toEndWith('pass_with_dataset_with_data_set_____my_datas_set_value___.snap')
|
||||||
->and($this->snapshotable)->toMatchSnapshot();
|
->and($this->snapshotable)->toMatchSnapshot();
|
||||||
})->with(['my-datas-set-value']);
|
})->with(['my-datas-set-value']);
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ describe('within describe', function () {
|
|||||||
[$filename] = TestSuite::getInstance()->snapshots->get();
|
[$filename] = TestSuite::getInstance()->snapshots->get();
|
||||||
|
|
||||||
expect($filename)->toStartWith('tests/.pest/snapshots/')
|
expect($filename)->toStartWith('tests/.pest/snapshots/')
|
||||||
->toEndWith('pass_with_dataset_with_data_set____my_datas_set_value______my_datas_set_value__.snap')
|
->toEndWith('pass_with_dataset_with_data_set_____my_datas_set_value___.snap')
|
||||||
->and($this->snapshotable)->toMatchSnapshot();
|
->and($this->snapshotable)->toMatchSnapshot();
|
||||||
});
|
});
|
||||||
})->with(['my-datas-set-value']);
|
})->with(['my-datas-set-value']);
|
||||||
|
|||||||
@ -40,7 +40,7 @@ it('alerts users about tests with arguments but no input', function () {
|
|||||||
$testSuite->tests->set($method);
|
$testSuite->tests->set($method);
|
||||||
})->throws(
|
})->throws(
|
||||||
DatasetMissing::class,
|
DatasetMissing::class,
|
||||||
sprintf("A test with the description '%s' has %d argument(s) ([%s]) and no dataset(s) provided in %s", 'bar', 1, 'int $arg', 'foo'),
|
sprintf('A test with the description [%s] has [%d] argument(s) ([%s]) and no dataset(s) provided in [%s]', 'bar', 1, 'int $arg', 'foo'),
|
||||||
);
|
);
|
||||||
|
|
||||||
it('can return an array of all test suite filenames', function () {
|
it('can return an array of all test suite filenames', function () {
|
||||||
|
|||||||
@ -16,7 +16,7 @@ $run = function () {
|
|||||||
|
|
||||||
test('parallel', function () use ($run) {
|
test('parallel', function () use ($run) {
|
||||||
expect($run('--exclude-group=integration'))
|
expect($run('--exclude-group=integration'))
|
||||||
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 39 todos, 26 skipped, 1179 passed (2792 assertions)')
|
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 39 todos, 26 skipped, 1178 passed (2790 assertions)')
|
||||||
->toContain('Parallel: 3 processes');
|
->toContain('Parallel: 3 processes');
|
||||||
})->skipOnWindows();
|
})->skipOnWindows();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user