Exemplo n.º 1
0
 protected function setUp()
 {
     $this->localeDate = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\Timezone', [], [], '', false);
     $this->config = $this->getMock('Magento\\Eav\\Model\\Config', ['getEntityType'], [], '', false);
     $type = $this->getMock('\\Magento\\Eav\\Model\\Entity\\Type', [], [], '', false);
     $this->config->expects($this->once())->method('getEntityType')->willReturn($type);
     $this->resource = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->storeManager = $this->getMock('Magento\\Store\\Model\\StoreManager', [], [], '', false);
     $this->logger = $this->getMock('Magento\\Framework\\Logger\\Monolog', [], [], '', false);
     $this->collection = $this->getMock('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\CollectionFactory', [], [], '', false);
     $this->abstractCollection = $this->getMockForAbstractClass('\\Magento\\Eav\\Model\\Entity\\Collection\\AbstractCollection', [], '', false, true, true, ['count', 'setOrder', 'setStoreId', 'getCurPage', 'getLastPageNumber']);
     $this->exportConfig = $this->getMock('Magento\\ImportExport\\Model\\Export\\Config', [], [], '', false);
     $this->productFactory = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\ProductFactory', ['create', 'getTypeId'], [], '', false);
     $this->attrSetColFactory = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\CollectionFactory', ['create', 'setEntityTypeFilter'], [], '', false);
     $this->categoryColFactory = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Category\\CollectionFactory', ['create', 'addNameToResult'], [], '', false);
     $this->itemFactory = $this->getMock('Magento\\CatalogInventory\\Model\\ResourceModel\\Stock\\ItemFactory', [], [], '', false);
     $this->optionColFactory = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Option\\CollectionFactory', [], [], '', false);
     $this->attributeColFactory = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory', [], [], '', false);
     $this->typeFactory = $this->getMock('Magento\\CatalogImportExport\\Model\\Export\\Product\\Type\\Factory', [], [], '', false);
     $this->linkTypeProvider = $this->getMock('Magento\\Catalog\\Model\\Product\\LinkTypeProvider', [], [], '', false);
     $this->rowCustomizer = $this->getMock('Magento\\CatalogImportExport\\Model\\Export\\RowCustomizer\\Composite', [], [], '', false);
     $this->metadataPool = $this->getMock('\\Magento\\Framework\\Model\\Entity\\MetadataPool', [], [], '', false);
     $this->writer = $this->getMock('Magento\\ImportExport\\Model\\Export\\Adapter\\AbstractAdapter', ['setHeaderCols', 'writeRow', 'getContents'], [], '', false);
     $constructorMethods = ['initTypeModels', 'initAttributes', '_initStores', 'initAttributeSets', 'initWebsites', 'initCategories'];
     $mockMethods = array_merge($constructorMethods, ['_customHeadersMapping', '_prepareEntityCollection', '_getEntityCollection', 'getWriter', 'getExportData', '_headerColumns', '_customFieldsMapping', 'getItemsPerPage', 'paginateCollection', '_getHeaderColumns']);
     $this->product = $this->getMock('Magento\\CatalogImportExport\\Model\\Export\\Product', $mockMethods, [], '', false);
     foreach ($constructorMethods as $method) {
         $this->product->expects($this->once())->method($method)->will($this->returnSelf());
     }
     $this->product->__construct($this->localeDate, $this->config, $this->resource, $this->storeManager, $this->logger, $this->collection, $this->exportConfig, $this->productFactory, $this->attrSetColFactory, $this->categoryColFactory, $this->itemFactory, $this->optionColFactory, $this->attributeColFactory, $this->typeFactory, $this->linkTypeProvider, $this->rowCustomizer, $this->metadataPool);
     $this->object = new StubProduct();
 }
Exemplo n.º 2
0
 /**
  * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
  * @param \Magento\Eav\Model\Config $config
  * @param \Magento\Framework\App\ResourceConnection $resource
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Psr\Log\LoggerInterface $logger
  * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory
  * @param \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig
  * @param \Magento\Catalog\Model\ResourceModel\ProductFactory $productFactory
  * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $attrSetColFactory
  * @param \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryColFactory
  * @param \Magento\CatalogInventory\Model\ResourceModel\Stock\ItemFactory $itemFactory
  * @param \Magento\Catalog\Model\ResourceModel\Product\Option\CollectionFactory $optionColFactory
  * @param \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $attributeColFactory
  * @param \Magento\CatalogImportExport\Model\Export\Product\Type\Factory $_typeFactory
  * @param \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider
  * @param \Magento\CatalogImportExport\Model\Export\RowCustomizerInterface $rowCustomizer
  * @param ImportProduct\StoreResolver $storeResolver
  * @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository
  * @throws \Magento\Framework\Exception\LocalizedException
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Eav\Model\Config $config, \Magento\Framework\App\ResourceConnection $resource, \Magento\Store\Model\StoreManagerInterface $storeManager, \Psr\Log\LoggerInterface $logger, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory, \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig, \Magento\Catalog\Model\ResourceModel\ProductFactory $productFactory, \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $attrSetColFactory, \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryColFactory, \Magento\CatalogInventory\Model\ResourceModel\Stock\ItemFactory $itemFactory, \Magento\Catalog\Model\ResourceModel\Product\Option\CollectionFactory $optionColFactory, \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $attributeColFactory, \Magento\CatalogImportExport\Model\Export\Product\Type\Factory $_typeFactory, \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider, \Magento\CatalogImportExport\Model\Export\RowCustomizerInterface $rowCustomizer, \Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver, \Magento\Customer\Api\GroupRepositoryInterface $groupRepository)
 {
     $this->_storeResolver = $storeResolver;
     $this->_groupRepository = $groupRepository;
     $this->_resource = $resource;
     parent::__construct($localeDate, $config, $resource, $storeManager, $logger, $collectionFactory, $exportConfig, $productFactory, $attrSetColFactory, $categoryColFactory, $itemFactory, $optionColFactory, $attributeColFactory, $_typeFactory, $linkTypeProvider, $rowCustomizer);
 }