PHP code example of railken / lara-command-test

1. Go to this page and download the library: Download railken/lara-command-test library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

railken / lara-command-test example snippets


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, []);