protected function SourceTestBase::createDefaultStore in Commerce Migrate 3.0.x
Same name and namespace in other branches
- 8.2 modules/commerce/tests/src/Kernel/Plugin/migrate/source/commerce1/SourceTestBase.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1\SourceTestBase::createDefaultStore()
- 3.1.x modules/commerce/tests/src/Kernel/Plugin/migrate/source/commerce1/SourceTestBase.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1\SourceTestBase::createDefaultStore()
Creates a default store.
1 call to SourceTestBase::createDefaultStore()
- SourceTestBase::setUp in modules/
commerce/ tests/ src/ Kernel/ Plugin/ migrate/ source/ commerce1/ SourceTestBase.php
File
- modules/
commerce/ tests/ src/ Kernel/ Plugin/ migrate/ source/ commerce1/ SourceTestBase.php, line 44
Class
- SourceTestBase
- Tests Commerce 1 product display source plugin.
Namespace
Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1Code
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);
}