//If testing environment then execute this .. if (env('APP_ENV', '') == 'testing') { // Here you condition }