Ejemplo n.º 1
0
 /**
  * Prepare data from text to values.
  *
  * @param StoreGroup $fixture
  * @return array
  */
 protected function prepareData(StoreGroup $fixture)
 {
     $categoryId = $fixture->getDataFieldConfig('root_category_id')['source']->getCategory()->getId();
     $websiteId = $fixture->getDataFieldConfig('website_id')['source']->getWebsite()->getWebsiteId();
     $data = ['group' => ['name' => $fixture->getName(), 'root_category_id' => $categoryId, 'website_id' => $websiteId, 'group_id' => $fixture->hasData('group_id') ? $fixture->getGroupId() : ''], 'store_action' => 'add', 'store_type' => 'group'];
     return $data;
 }
 /**
  * Persist store with created website.
  *
  * @param StoreGroup $store
  * @return StoreGroup
  */
 protected function persistStore(StoreGroup $store)
 {
     $category = $store->getDataFieldConfig('root_category_id')['source']->getCategory();
     $data = ['website_id' => ['website' => $this->website], 'root_category_id' => ['category' => $category]];
     $store = $this->fixtureFactory->createByCode('storeGroup', ['data' => array_merge($store->getData(), $data)]);
     $store->persist();
     return $store;
 }