protected function CsvTestBase::createDefaultStore in Commerce Migrate 3.1.x
Same name and namespace in other branches
- 8.2 tests/src/Kernel/CsvTestBase.php \Drupal\Tests\commerce_migrate\Kernel\CsvTestBase::createDefaultStore()
- 3.0.x tests/src/Kernel/CsvTestBase.php \Drupal\Tests\commerce_migrate\Kernel\CsvTestBase::createDefaultStore()
Creates a default store.
File
- tests/
src/ Kernel/ CsvTestBase.php, line 227
Class
- CsvTestBase
- Test base for migrations tests with CSV source file.
Namespace
Drupal\Tests\commerce_migrate\KernelCode
protected function createDefaultStore() {
$currency_importer = \Drupal::service('commerce_price.currency_importer');
/** @var \Drupal\commerce_store\StoreStorage $store_storage */
$store_storage = \Drupal::service('entity_type.manager')
->getStorage('commerce_store');
$currency_importer
->import('USD');
$store_values = [
'type' => 'default',
'uid' => 1,
'name' => 'Demo store',
'mail' => 'admin@example.com',
'address' => [
'country_code' => 'US',
],
'default_currency' => 'USD',
];
/** @var \Drupal\commerce_store\Entity\StoreInterface $store */
$store = $store_storage
->create($store_values);
$store
->save();
$store_storage
->markAsDefault($store);
}