/** * Assert existing product on admin product grid * * @return void */ protected function assertOnBackend() { $productGridPage = Factory::getPageFactory()->getCatalogProductIndex(); $productGridPage->open(); $gridBlock = $productGridPage->getProductGrid(); $this->assertTrue($gridBlock->isRowVisible(array('sku' => $this->product->getProductSku()))); }
/** * Prepare fixture data for verify * * @param DownloadableProduct $product * @return array */ protected function prepareFixtureData(DownloadableProduct $product) { $data = $this->sortDataByPath($product->getDownloadableSample(), 'downloadable/sample::sort_order'); foreach ($data['downloadable']['sample'] as $key => $link) { $link = array_intersect_key($link, array_flip($this->linkField)); $data['downloadable']['sample'][$key] = $link; } $data = array_intersect_key($data, array_flip($this->downloadableSampleField)); return $data; }
/** * Prepare fixture data for verify * * @param DownloadableProduct $product * @return array */ protected function prepareFixtureData(DownloadableProduct $product) { $data = $this->sortDataByPath($product->getDownloadableLinks(), 'downloadable/link::sort_order'); foreach ($data['downloadable']['link'] as $key => $link) { $link['links_purchased_separately'] = $data['links_purchased_separately']; $link = array_intersect_key($link, array_flip($this->linkField)); $data['downloadable']['link'][$key] = $link; } $data = array_intersect_key($data, array_flip($this->downloadableLinksField)); return $data; }
/** * Test update downloadable product * * @param DownloadableProduct $product * @param Category $category * @return void */ public function test(DownloadableProduct $product, Category $category) { // Steps $filter = ['sku' => $this->product->getSku()]; $this->catalogProductIndex->open()->getProductGrid()->searchAndOpen($filter); $productBlockForm = $this->catalogProductEdit->getProductForm(); $productBlockForm->fill($product, null, $category); $this->catalogProductEdit->getFormPageActions()->save(); }
/** * Prepare data for downloadable product. * * @param DownloadableProduct $product * @return array */ protected function prepareDownloadableData(DownloadableProduct $product) { $result = []; $checkoutData = $product->getCheckoutData(); foreach ($checkoutData['options']['links'] as $link) { $result['links'][] = $link['id']; } return $result; }
/** * Prepare downloadable product options. * * @param DownloadableProduct $product * @return array */ protected function prepareDownloadableOptions(DownloadableProduct $product) { $checkoutData = $product->getCheckoutData(); $links = []; foreach ($checkoutData['options']['links'] as $link) { $links[] = $link['id']; } return ['extension_attributes' => ['downloadable_option' => ['downloadable_links' => $links]]]; }
/** * Init downloadable data */ protected function _initData() { parent::_initData(); $this->_data = array_replace_recursive($this->_data, ['fields' => ['downloadable_links' => ['value' => ['title' => 'Links%isolation%', 'links_purchased_separately' => 'Yes', 'downloadable' => ['link' => [['title' => 'row1%isolation%', 'price' => 2.43, 'number_of_downloads' => 2, 'sample' => ['sample_type_url' => 'Yes', 'sample_url' => 'http://example.com'], 'file_type_url' => 'Yes', 'file_link_url' => 'http://example.com', 'is_shareable' => 'No', 'sort_order' => 0]]]], 'group' => static::GROUP]]]); $this->_repository = Factory::getRepositoryFactory()->getMagentoDownloadableDownloadableProduct($this->_dataConfig, $this->_data); }