mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
Merge pull request #620 from alexmanase/2.x-fix-ignored-description-for-lazy-datasets
[2.x] Fix: ignored dataset description for string description
This commit is contained in:
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Pest\Repositories;
|
namespace Pest\Repositories;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
|
use Generator;
|
||||||
use Pest\Exceptions\DatasetAlreadyExists;
|
use Pest\Exceptions\DatasetAlreadyExists;
|
||||||
use Pest\Exceptions\DatasetDoesNotExist;
|
use Pest\Exceptions\DatasetDoesNotExist;
|
||||||
use Pest\Exceptions\ShouldNotHappen;
|
use Pest\Exceptions\ShouldNotHappen;
|
||||||
@ -155,7 +156,10 @@ final class DatasetsRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
|||||||
@ -107,6 +107,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 (...)) #1
|
✓ it can resolve a dataset after the test case is available with (Closure Object (...)) #1
|
||||||
✓ it can resolve a dataset after the test case is available with (Closure Object (...)) #2
|
✓ it can resolve a dataset after the test case is available with (Closure Object (...)) #2
|
||||||
✓ 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
|
||||||
@ -897,4 +899,4 @@
|
|||||||
PASS Tests\Visual\Version
|
PASS Tests\Visual\Version
|
||||||
✓ visual snapshot of help command output
|
✓ visual snapshot of help command output
|
||||||
|
|
||||||
Tests: 4 incomplete, 2 todos, 18 skipped, 622 passed (1509 assertions)
|
|
||||||
|
|||||||
@ -249,6 +249,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([
|
||||||
|
|||||||
Reference in New Issue
Block a user