Skip to content

Prompt::fake() incompatible with PendingCommand created by $this->artisan()? #158

@jesseleite

Description

@jesseleite

Laravel Prompts Version

0.1.24

Laravel Version

11.19.0

PHP Version

8.3.7

Operating System & Version

macOS 14.2

Terminal Application

WezTerm

Description

Working on some tests for Statamic... I did a code dive and found your Prompt::fake() helper, which is genious! 🔥

However, I've noticed an issue where tests containing Prompt::fake() pass when run in isolation...

CleanShot 2024-08-03 at 23 15 08

But they fail when the whole test case and/or suite is ran...

CleanShot 2024-08-03 at 23 15 40

We're hoping to use Prompt::fake() in our Statamic core test suite, but I can't get it to play nicely with other tests where we use $this->artisan().

It seems that PendingCommand is leaking mock expectations into other tests which use Prompt::fake(). I'm not sure how to solve, or if there's a way to improve Prompt::fake() for packages who wish to use it? 🤔

I've created a repo with an example test case to make it easier to reproduce, if that helps!

Any thoughts? 🙏

Steps To Reproduce

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions