nunomaduro / laravel-console-menu

🔘 Beautiful PHP CLI menus. Is a php-school/cli-menu wrapper for Laravel/Artisan Console Commands
MIT License
802 stars 40 forks source link

Testing Menus #29

Closed tonysm closed 3 years ago

tonysm commented 3 years ago

Hey, I was wondering if anyone has hinted at testing these menus. I tried calling the command that shows the menu with $this->artisan(), but the menu shows up in the console and blocks.

I was thinking if we could add an API to it like

$this->artisan('command')
  ->expectMenu(
    fn (TestMenu $menu) => $menu->hasOption('something')->select('something')
  );

(not sure if any of this is possible yet, just thinking of how I'd like to test it if it was possible)

nunomaduro commented 3 years ago

We don't have that feature. But feel free to make a pull request.