Summer Sale! All accounts are 50% off this week.

msclower's avatar

Trying to run grouped Unit tests from a customer Laravel command.

But alas it ignores the group setting, running all the tests. Trying to replicate: php artisan test --group mariadb with: Artisan::call('test',['--group' => ['mariadb'], ]);

in addition, how do you take them output from dump(Artisan::output()); And displaying it with colour. Basically I want to run number of grouped tests from a command and display the output, maybe save to a file.

0 likes
5 replies
Tray2's avatar

Share some code and someone might be able to help you.

msclower's avatar

The laravel command::

Artisan::call('test',['--group' => ['mariadb'], ]);

runs all unit tests, whereas I would like it to only run tests in group mariadb. The equivalent of:

php artisan test --group mariadb

msclower's avatar

I have tried:

Artisan::call('test',['--group' => 'mariadb', ]); Artisan::call('test',['--group' => ['mariadb',], ]); Artisan::call('test',['--group mariadb' ]);

But these either run all the tests or fail.

bugsysha's avatar

Have you tried Artisan::call('test --group=mariadb'); or Artisan::call('test --group mariadb');?

msclower's avatar

@bugsysha Yes, might have been the first one I tried. The format is supposedly command followed by parameters.

Please or to participate in this conversation.