laravel / prompts

Beautiful and user-friendly forms for your command-line PHP applications.
https://laravel.com/docs/prompts
MIT License
532 stars 94 forks source link

Artisan asserts not working with textarea #131

Closed james-astalty closed 7 months ago

james-astalty commented 7 months ago

Laravel Prompts Version

0.1.18

Laravel Version

11.3.1

PHP Version

8.2

Operating System & Version

14.2

Terminal Application

zsh

Description

When using a text input, you can use expectsQuestion when running artisan tests but when using a textarea, the tests hang.

Steps To Reproduce

  1. Clone https://github.com/lioneaglesolutions/prompts-textarea-repro
  2. Run composer install
  3. Run ./vendor/bin/test
  4. The test will hang

I'm not quite sure if this is a Prompts issue or Framework issue but I had a dive into the source and could not work out what could be causing this.

driesvints commented 7 months ago

@jessarcher @joetannenbaum do we still need to adjust something to make this work?

jessarcher commented 7 months ago

laravel/framework will need a Symfony fallback (which is also used for tests).

I think we can use https://symfony.com/doc/current/components/console/helpers/questionhelper.html#accept-multiline-answers. Failing that, we can probably fall back to a single-line prompt.

On a separate note, I'm curious why Symfony uses Ctrl+Z to submit on Windows and whether we should do the same.

Will jump onto this next week unless @joetannenbaum beats me to it.

james-astalty commented 7 months ago

@jessarcher sorry I have 2 Github accounts going - does https://github.com/laravel/framework/pull/51055 address this? I also found some other issues with assertions when writing those tests but need that PR to be merged as I want to keep the PRs separate and add more tests to fix the other assertion problems.

jessarcher commented 7 months ago

https://github.com/laravel/framework/pull/51055 should fix this :+1: