You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If more than one of the values in a single dataset are namespaced class strings Pest fails or errors.
How to Reproduce
The following test causes Pest to error out with the message Typed static property P\Tests\Feature\ExampleTest::$__latestDescription must not be accessed before initialization:
useApp\Http\Controllers\Controller;
useIlluminate\Database\Eloquent\Model;
test('returns a successful response', function (string$first) {
expect(true)->toBeTrue();
})->with([Model::class, Controller::class]);
Changing either Model::class or Controller::class to a literal string (e.g. 'App\Model') fixes that particular example, but this doesn't always work.
Sample Repository
No response
Pest Version
2.34.4
PHP Version
8.2.15
Operation System
macOS
Notes
This doesn't seem to reproduce consistently. I can make it fail with some class name strings but not others, sometimes using ::class notation and sometimes with literal strings, etc.
The text was updated successfully, but these errors were encountered:
bakerkretzmar
changed the title
[Bug]: Pest errors if certain ::class notation appears multiple times inside a single dataset
[Bug]: Pest errors if namespaced class name string appears multiple times inside a single dataset
Mar 15, 2024
In your second example it's working as it is supposed to, actually you are passing only one argument.
It's going through the dataset one by one so it is providing only one argument in your case (Controller::class in first iteration then Model::class in second). If you need to pass two your need to rewrite your dataset like:
What Happened
If more than one of the values in a single dataset are namespaced class strings Pest fails or errors.
How to Reproduce
The following test causes Pest to error out with the message
Typed static property P\Tests\Feature\ExampleTest::$__latestDescription must not be accessed before initialization
:Changing either
Model::class
orController::class
to a literal string (e.g.'App\Model'
) fixes that particular example, but this doesn't always work.Sample Repository
No response
Pest Version
2.34.4
PHP Version
8.2.15
Operation System
macOS
Notes
This doesn't seem to reproduce consistently. I can make it fail with some class name strings but not others, sometimes using
::class
notation and sometimes with literal strings, etc.The text was updated successfully, but these errors were encountered: