9 use Magento\Mtf\Fixture\DataSource;
10 use Magento\Mtf\Fixture\FixtureFactory;
30 private $websites = [];
37 private $fixtureFactory;
44 private $fixtureData =
null;
53 FixtureFactory $fixtureFactory,
57 $this->fixtureFactory = $fixtureFactory;
59 $this->fixtureData =
$data;
71 if (empty($this->fixtureData)) {
72 throw new \Exception(
"Data must be set");
75 foreach ($this->fixtureData as $dataset) {
76 if (is_array($dataset) && isset($dataset[
'websites'])) {
77 foreach ($dataset[
'websites'] as
$website) {
81 $this->createStore($dataset);
85 return parent::getData($key);
94 private function createStore($dataset)
96 if ($dataset instanceof Store) {
98 }
elseif (is_array($dataset)) {
99 $store = isset($dataset[
'store']) ? $dataset[
'store'] :
100 (isset($dataset[
'dataset']) ? $this->fixtureFactory->createByCode(
'store', $dataset) :
null);
103 $this->setWebsiteStoreData(
$store);
113 private function setWebsiteStoreData(Store
$store)
115 if (!
$store->getStoreId()) {
119 ->getStoreGroup()->getDataFieldConfig(
'website_id')[
'source']->getWebsite();
120 $this->data[] =
$website->getName();
132 return $this->stores;
142 return $this->websites;
__construct(FixtureFactory $fixtureFactory, array $params, $data=[])
elseif(isset( $params[ 'redirect_parent']))
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]