1 month ago

Testing Artisan Commands when developing vendor packages

Posted 1 month ago by automica

I am working on adding some tests to a vendor package that provides 6 artisan commands.

I'm working with it in a repo separate to my Laravel 8 installation and have updated composer so it knows to use the local development version, and this is working.

What I'm looking to do is to run the command via artisan and test some assertions.


->expectsOutput('some output')

when I run the commands test, I get the following:

Error: Call to undefined method Tests\Unit\ListCommandTest::artisan()

I've found which is similar'ish to my issue.

Has anyone any advice on best way to proceed here, and what I would need to do to call artisan?

Please sign in or create an account to participate in this conversation.