Compare commits

...

4 Commits

Author SHA1 Message Date
b58a020423 release: v1.22.3 2022-12-07 14:31:55 +00:00
e337a52cda Merge pull request #612 from alexmanase/1.x-fix-ignored-description-for-layz-datasets
[1.x] Fixes ignored dataset description only for string description
2022-12-07 14:23:55 +00:00
0a6873d8a6 wip 2022-11-17 16:14:03 +02:00
09b7ab9a42 fixes ignored dataset description for string description 2022-11-17 15:43:30 +02:00
5 changed files with 20 additions and 3 deletions

View File

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [v1.22.3 (2022-12-07)](https://github.com/pestphp/pest/compare/v1.22.2...v1.22.3)
### Fixed
- Fixes ignoring datasets description on lazy datasets ([#612](https://github.com/pestphp/pest/pull/612))
## [v1.22.2 (2022-11-09)](https://github.com/pestphp/pest/compare/v1.22.1...v1.22.2) ## [v1.22.2 (2022-11-09)](https://github.com/pestphp/pest/compare/v1.22.1...v1.22.2)
### Fixed ### Fixed
- Fixes storing lazy datasets into internal array ([#602](https://github.com/pestphp/pest/pull/602)) - Fixes storing lazy datasets into internal array ([#602](https://github.com/pestphp/pest/pull/602))

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Pest; namespace Pest;
use Closure; use Closure;
use Generator;
use Pest\Exceptions\DatasetAlreadyExist; use Pest\Exceptions\DatasetAlreadyExist;
use Pest\Exceptions\DatasetDoesNotExist; use Pest\Exceptions\DatasetDoesNotExist;
use SebastianBergmann\Exporter\Exporter; use SebastianBergmann\Exporter\Exporter;
@ -122,7 +123,10 @@ final class Datasets
} }
if ($datasets[$index] instanceof Traversable) { if ($datasets[$index] instanceof Traversable) {
$datasets[$index] = iterator_to_array($datasets[$index], false); $preserveKeysForArrayIterator = $datasets[$index] instanceof Generator
&& is_string($datasets[$index]->key());
$datasets[$index] = iterator_to_array($datasets[$index], $preserveKeysForArrayIterator);
} }
foreach ($datasets[$index] as $key => $values) { foreach ($datasets[$index] as $key => $values) {

View File

@ -6,7 +6,7 @@ namespace Pest;
function version(): string function version(): string
{ {
return '1.22.2'; return '1.22.3';
} }
function testDirectory(string $file = ''): string function testDirectory(string $file = ''): string

View File

@ -101,6 +101,8 @@
✓ eager registered wrapped datasets with Generator functions with (3) ✓ eager registered wrapped datasets with Generator functions with (3)
✓ eager registered wrapped datasets with Generator functions with (4) ✓ eager registered wrapped datasets with Generator functions with (4)
✓ eager registered wrapped datasets with Generator functions did the job right ✓ eager registered wrapped datasets with Generator functions did the job right
✓ eager registered wrapped datasets with Generator functions display description with data set "taylor"
✓ eager registered wrapped datasets with Generator functions display description with data set "james"
✓ it can resolve a dataset after the test case is available with (Closure Object (...)) ✓ it can resolve a dataset after the test case is available with (Closure Object (...))
✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #1 ✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #1
✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #2 ✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #2
@ -727,5 +729,5 @@
✓ it is a test ✓ it is a test
✓ it uses correct parent class ✓ it uses correct parent class
Tests: 4 incompleted, 9 skipped, 485 passed Tests: 4 incompleted, 9 skipped, 487 passed

View File

@ -247,6 +247,13 @@ test('eager registered wrapped datasets with Generator functions did the job rig
expect($wrapped_generator_state->text)->toBe('1234'); expect($wrapped_generator_state->text)->toBe('1234');
}); });
test('eager registered wrapped datasets with Generator functions display description', function ($wrapped_generator_state_with_description) {
expect($wrapped_generator_state_with_description)->not->toBeEmpty();
})->with(function () {
yield 'taylor' => 'taylor@laravel.com';
yield 'james' => 'james@laravel.com';
});
it('can resolve a dataset after the test case is available', function ($result) { it('can resolve a dataset after the test case is available', function ($result) {
expect($result)->toBe('bar'); expect($result)->toBe('bar');
})->with([ })->with([