Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Stores.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Fixture\DataSource;
10 use Magento\Mtf\Fixture\FixtureFactory;
11 
18 class Stores extends DataSource
19 {
25  private $stores;
26 
33  public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = [])
34  {
35  $this->params = $params;
36  if (isset($data['dataset'])) {
37  $datasets = is_array($data['dataset']) ? $data['dataset'] : [$data['dataset']];
38  foreach ($datasets as $dataset) {
40  $store = $fixtureFactory->createByCode('store', ['dataset' => $dataset]);
41  if (!$store->hasData('store_id')) {
42  $store->persist();
43  }
44  $this->stores[] = $store;
45  $this->data[] = $store->getGroupId() . '/' . $store->getName();
46  }
47  }
48  }
49 
55  public function getStores()
56  {
57  return $this->stores;
58  }
59 }
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18