adrian7's avatar

How would you approach testing artisan commands using codeception with lumen module

I am trying to set up functional tests from my artisan commands using codeception with Lumen module.

However using Artisan::call does not give me any results.

    use Illuminate\Support\Facades\Artisan;

    $I = new FunctionalTester($scenario);
    $I->wantTo('Test artisan command');

    $value = Artisan::call('config:get', ['app.key']);

    assert($value != 0, 'The application key is set.');

I am curious if anyone tried this before, and how they manage to implement it.

Thanks.

0 likes
1 reply
adrian7's avatar
adrian7
OP
Best Answer
Level 1

I just realized I was doing something wrong, as Artisan::call would not return any output. If you want the output of your previous command you should call Artisan::output().

My test works now.

Please or to participate in this conversation.