diff --git a/database/seeds/TestCompany.php b/database/seeds/TestCompany.php index 373cab2e6..cdf1263f0 100644 --- a/database/seeds/TestCompany.php +++ b/database/seeds/TestCompany.php @@ -7,6 +7,7 @@ use App\Jobs\Auth\CreateUser; use App\Jobs\Common\CreateCompany; use App\Jobs\Common\CreateContact; use App\Traits\Jobs; +use Artisan; use Illuminate\Database\Seeder; class TestCompany extends Seeder @@ -28,7 +29,9 @@ class TestCompany extends Seeder $this->createUser(); - $this->createContact(); + $this->createCustomer(); + + $this->installModules(); Model::reguard(); } @@ -69,12 +72,12 @@ class TestCompany extends Seeder $this->command->info('Test user created.'); } - private function createContact() + private function createCustomer() { $this->dispatch(new CreateContact([ 'type' => 'customer', - 'name' => 'Test Contact', - 'email' => 'contact@company.com', + 'name' => 'Test Customer', + 'email' => 'customer@company.com', 'currency_code' => setting('default.currency', 'USD'), 'password' => '123456', 'password_confirmation' => '123456', @@ -83,6 +86,29 @@ class TestCompany extends Seeder 'create_user' => 1, ])); - $this->command->info('Test contact created.'); + $this->command->info('Test customer created.'); + } + + private function installModules() + { + $core_modules = ['offline-payments', 'paypal-standard']; + + $modules = module()->all(); + + foreach ($modules as $module) { + $alias = $module->getAlias(); + + if (in_array($alias, $core_modules)) { + continue; + } + + Artisan::call('module:install', [ + 'alias' => $alias, + 'company' => session('company_id'), + 'locale' => session('locale', app()->getLocale()), + ]); + } + + $this->command->info('Modules installed.'); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index e157590a0..527c35a04 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -17,6 +17,5 @@ abstract class TestCase extends BaseTestCase parent::setUp(); Artisan::call('db:seed', ['--class' => '\Database\Seeds\TestCompany', '--force' => true]); - Artisan::call('company:seed', ['company' => 1]); } }