railken/lara-command-test

v1.0.3 2018-05-25 13:55 UTC

This package is auto-updated.

Last update: 2024-12-05 18:53:45 UTC


README

Build Status License

A laravel package to call commands that have prompt inputs

Simple usage

use Illuminate\Console\Command;

class DummyCommand extends Command
{

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        if ($this->confirm("Should we go?")) {

            $response = $this->ask('Is it hello?');
            
            return $response === 'Hello' ? 1 : 0;
        }

        return 0;
    }
}
use Railken\LaraCommandTest\Helper;

$helper = new Helper(__DIR__ . "/../var/cache");
$command = $helper->generate(DummyCommand::class, [
    'yes',
    'Hello'
]);
$helper->call($command, []);