mirror of
https://github.com/pestphp/pest.git
synced 2026-03-10 09:47:23 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c3616edbc8 | |||
| 21143b2693 | |||
| 006f9232cc | |||
| d1b61a34de | |||
| 896317ac97 | |||
| 4fd5c0edd4 | |||
| e2c5d6d857 | |||
| 8057fe4bc2 | |||
| ebc9690301 | |||
| 36fd18bcc8 | |||
| aa352317cb | |||
| edcd2cb50e |
12
.github/workflows/changelog.yml
vendored
12
.github/workflows/changelog.yml
vendored
@ -21,8 +21,9 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CHANGELOG_KEY }}
|
token: ${{ secrets.CHANGELOG_KEY }}
|
||||||
repository: pestphp/website
|
repository: pestphp/docs
|
||||||
path: pestphp-website
|
path: pestphp-docs
|
||||||
|
ref: master
|
||||||
- name: Read CHANGELOG.md
|
- name: Read CHANGELOG.md
|
||||||
id: package
|
id: package
|
||||||
uses: juliangruber/read-file-action@v1
|
uses: juliangruber/read-file-action@v1
|
||||||
@ -36,8 +37,6 @@ jobs:
|
|||||||
---
|
---
|
||||||
title: Changelog
|
title: Changelog
|
||||||
description: Changelog
|
description: Changelog
|
||||||
extends: _layouts.documentation
|
|
||||||
section: content
|
|
||||||
---
|
---
|
||||||
${{ steps.package.outputs.content }}
|
${{ steps.package.outputs.content }}
|
||||||
|
|
||||||
@ -46,13 +45,14 @@ jobs:
|
|||||||
Next section: [Upgrade Guide →](/docs/upgrade-guide)
|
Next section: [Upgrade Guide →](/docs/upgrade-guide)
|
||||||
write-mode: overwrite
|
write-mode: overwrite
|
||||||
- name: Copy CHANGELOG to website repository
|
- name: Copy CHANGELOG to website repository
|
||||||
run: cp CHANGELOG.md pestphp-website/source/docs/changelog.md
|
run: cp CHANGELOG.md pestphp-docs/changelog.md
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v2
|
uses: peter-evans/create-pull-request@v2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CHANGELOG_KEY }}
|
token: ${{ secrets.CHANGELOG_KEY }}
|
||||||
commit-message: Update changelog.md
|
commit-message: Update changelog.md
|
||||||
|
branch: master
|
||||||
committer: GitHub Action <noreply@github.com>
|
committer: GitHub Action <noreply@github.com>
|
||||||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||||
title: 'Update changelog.md'
|
title: 'Update changelog.md'
|
||||||
path: ./pestphp-website
|
path: ./pestphp-docs
|
||||||
|
|||||||
@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [v0.3.9 (2020-10-13)](https://github.com/pestphp/pest/compare/v0.3.8...v0.3.9)
|
||||||
|
### Added
|
||||||
|
- Add support for named datasets in description output ([#134](https://github.com/pestphp/pest/pull/134))
|
||||||
|
- Add Pest version to `--help` output ([#203](https://github.com/pestphp/pest/pull/203))
|
||||||
|
- Add support for PHPUnit 9.4.1 ([#207](https://github.com/pestphp/pest/pull/207))
|
||||||
|
|
||||||
## [v0.3.8 (2020-10-03)](https://github.com/pestphp/pest/compare/v0.3.7...v0.3.8)
|
## [v0.3.8 (2020-10-03)](https://github.com/pestphp/pest/compare/v0.3.7...v0.3.8)
|
||||||
### Added
|
### Added
|
||||||
- Add support for PHPUnit 9.4.0 ([#199](https://github.com/pestphp/pest/pull/199))
|
- Add support for PHPUnit 9.4.0 ([#199](https://github.com/pestphp/pest/pull/199))
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
"pestphp/pest-plugin": "^0.3",
|
"pestphp/pest-plugin": "^0.3",
|
||||||
"pestphp/pest-plugin-coverage": "^0.3",
|
"pestphp/pest-plugin-coverage": "^0.3",
|
||||||
"pestphp/pest-plugin-init": "^0.3",
|
"pestphp/pest-plugin-init": "^0.3",
|
||||||
"phpunit/phpunit": ">= 9.3.7 <= 9.4.0"
|
"phpunit/phpunit": ">= 9.3.7 <= 9.4.1"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|||||||
@ -11,6 +11,8 @@ use Pest\Actions\ValidatesConfiguration;
|
|||||||
use Pest\Contracts\Plugins\AddsOutput;
|
use Pest\Contracts\Plugins\AddsOutput;
|
||||||
use Pest\Contracts\Plugins\HandlesArguments;
|
use Pest\Contracts\Plugins\HandlesArguments;
|
||||||
use Pest\Plugin\Loader;
|
use Pest\Plugin\Loader;
|
||||||
|
use Pest\Plugins\Version;
|
||||||
|
use Pest\Support\Container;
|
||||||
use Pest\TestSuite;
|
use Pest\TestSuite;
|
||||||
use PHPUnit\Framework\TestSuite as BaseTestSuite;
|
use PHPUnit\Framework\TestSuite as BaseTestSuite;
|
||||||
use PHPUnit\TextUI\Command as BaseCommand;
|
use PHPUnit\TextUI\Command as BaseCommand;
|
||||||
@ -139,4 +141,12 @@ final class Command extends BaseCommand
|
|||||||
|
|
||||||
exit($result);
|
exit($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function showHelp(): void
|
||||||
|
{
|
||||||
|
/** @var Version $version */
|
||||||
|
$version = Container::getInstance()->get(Version::class);
|
||||||
|
$version->handleArguments(['--version']);
|
||||||
|
parent::showHelp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,10 +77,10 @@ final class Datasets
|
|||||||
$dataSetDescriptions = [];
|
$dataSetDescriptions = [];
|
||||||
$dataSetValues = [];
|
$dataSetValues = [];
|
||||||
|
|
||||||
foreach ($data as $values) {
|
foreach ($data as $key => $values) {
|
||||||
$values = is_array($values) ? $values : [$values];
|
$values = is_array($values) ? $values : [$values];
|
||||||
|
|
||||||
$dataSetDescriptions[] = $description . self::getDataSetDescription($values);
|
$dataSetDescriptions[] = $description . self::getDataSetDescription($key, $values);
|
||||||
$dataSetValues[] = $values;
|
$dataSetValues[] = $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,12 +104,15 @@ final class Datasets
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param int|string $key
|
||||||
* @param array<int, mixed> $data
|
* @param array<int, mixed> $data
|
||||||
*/
|
*/
|
||||||
private static function getDataSetDescription(array $data): string
|
private static function getDataSetDescription($key, array $data): string
|
||||||
{
|
{
|
||||||
$exporter = new Exporter();
|
$exporter = new Exporter();
|
||||||
|
|
||||||
return \sprintf(' with (%s)', $exporter->shortenedRecursiveExport($data));
|
$nameInsert = is_string($key) ? \sprintf('data set "%s" ', $key) : '';
|
||||||
|
|
||||||
|
return \sprintf(' with %s(%s)', $nameInsert, $exporter->shortenedRecursiveExport($data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,5 +6,5 @@ namespace Pest;
|
|||||||
|
|
||||||
function version(): string
|
function version(): string
|
||||||
{
|
{
|
||||||
return '0.3.6';
|
return '0.3.9';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -255,6 +255,9 @@
|
|||||||
✓ eager wrapped registered datasets with (1)
|
✓ eager wrapped registered datasets with (1)
|
||||||
✓ eager wrapped registered datasets with (2)
|
✓ eager wrapped registered datasets with (2)
|
||||||
✓ eager registered wrapped datasets did the job right
|
✓ eager registered wrapped datasets did the job right
|
||||||
|
✓ named datasets with data set "one" (1)
|
||||||
|
✓ named datasets with data set "two" (2)
|
||||||
|
✓ named datasets did the job right
|
||||||
✓ lazy named datasets with (Bar Object (...))
|
✓ lazy named datasets with (Bar Object (...))
|
||||||
✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #1
|
✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #1
|
||||||
✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #2
|
✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #2
|
||||||
@ -345,6 +348,9 @@
|
|||||||
✓ it throws exception when `process isolation` is true
|
✓ it throws exception when `process isolation` is true
|
||||||
✓ it do not throws exception when `process isolation` is false
|
✓ it do not throws exception when `process isolation` is false
|
||||||
|
|
||||||
|
PASS Tests\Unit\Datasets
|
||||||
|
✓ it show the names of named datasets in their description
|
||||||
|
|
||||||
PASS Tests\Unit\Plugins\Version
|
PASS Tests\Unit\Plugins\Version
|
||||||
✓ it outputs the version when --version is used
|
✓ it outputs the version when --version is used
|
||||||
✓ it do not outputs version when --version is not used
|
✓ it do not outputs version when --version is not used
|
||||||
@ -385,5 +391,5 @@
|
|||||||
✓ depends with defined arguments
|
✓ depends with defined arguments
|
||||||
✓ depends run test only once
|
✓ depends run test only once
|
||||||
|
|
||||||
Tests: 7 skipped, 227 passed
|
Tests: 7 skipped, 231 passed
|
||||||
|
|
||||||
@ -95,6 +95,18 @@ test('eager registered wrapped datasets did the job right', function () use ($st
|
|||||||
expect($state->text)->toBe('1212121212');
|
expect($state->text)->toBe('1212121212');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('named datasets', function ($text) use ($state, $datasets) {
|
||||||
|
$state->text .= $text;
|
||||||
|
expect($datasets)->toContain([$text]);
|
||||||
|
})->with([
|
||||||
|
'one' => [1],
|
||||||
|
'two' => [2],
|
||||||
|
]);
|
||||||
|
|
||||||
|
test('named datasets did the job right', function () use ($state) {
|
||||||
|
expect($state->text)->toBe('121212121212');
|
||||||
|
});
|
||||||
|
|
||||||
class Bar
|
class Bar
|
||||||
{
|
{
|
||||||
public $name = 1;
|
public $name = 1;
|
||||||
|
|||||||
13
tests/Unit/Datasets.php
Normal file
13
tests/Unit/Datasets.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Pest\Datasets;
|
||||||
|
|
||||||
|
it('show the names of named datasets in their description', function () {
|
||||||
|
$descriptions = array_keys(Datasets::resolve('test description', [
|
||||||
|
'one' => [1],
|
||||||
|
'two' => [[2]],
|
||||||
|
]));
|
||||||
|
|
||||||
|
expect($descriptions[0])->toBe('test description with data set "one" (1)');
|
||||||
|
expect($descriptions[1])->toBe('test description with data set "two" (array(2))');
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user