Solution:
You can use the Process component provided by Symfony: http://symfony.com/doc/current/components/process.html
The component is used by Laravel itself, so your don’t need to install it via composer separately. Just add use Symfony\Component\Process\Process;
to your file.
If you use it(instead of php’s exec()
function), you’ll be able to unit test the code that calls shell commands.