當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Processor::getIndexer方法代碼示例

本文整理匯總了PHP中Magento\Catalog\Model\Indexer\Product\Flat\Processor::getIndexer方法的典型用法代碼示例。如果您正苦於以下問題:PHP Processor::getIndexer方法的具體用法?PHP Processor::getIndexer怎麽用?PHP Processor::getIndexer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Catalog\Model\Indexer\Product\Flat\Processor的用法示例。


在下文中一共展示了Processor::getIndexer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testProductUpdate

 /**
  * @magentoDataFixture Magento/Catalog/_files/row_fixture.php
  * @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1
  * @magentoAppArea frontend
  */
 public function testProductUpdate()
 {
     $this->markTestSkipped('Incomplete due to MAGETWO-21369');
     $categoryFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\CategoryFactory');
     $listProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Block\\Product\\ListProduct');
     $this->_processor->getIndexer()->setScheduled(false);
     $this->assertFalse($this->_processor->getIndexer()->isScheduled(), 'Indexer is in scheduled mode when turned to update on save mode');
     $this->_processor->reindexAll();
     $this->_product->load(1);
     $this->_product->setName('Updated Product');
     $this->_product->save();
     $category = $categoryFactory->create()->load(9);
     $layer = $listProduct->getLayer();
     $layer->setCurrentCategory($category);
     /** @var \Magento\Catalog\Model\Resource\Product\Collection $productCollection */
     $productCollection = $layer->getProductCollection();
     $this->assertTrue($productCollection->isEnabledFlat(), 'Product collection is not using flat resource when flat is on');
     $this->assertEquals(2, $productCollection->count(), 'Product collection items count must be exactly 2');
     foreach ($productCollection as $product) {
         /** @var $product \Magento\Catalog\Model\Product */
         if ($product->getId() == 1) {
             $this->assertEquals('Updated Product', $product->getName(), 'Product name from flat does not match with updated name');
         }
     }
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:30,代碼來源:RowTest.php

示例2: processValue

 /**
  * Process flat enabled mode change
  *
  * @return void
  */
 public function processValue()
 {
     if ((bool) $this->getValue() != (bool) $this->getOldValue()) {
         if ((bool) $this->getValue()) {
             $this->indexerState->loadByIndexer(\Magento\Catalog\Model\Indexer\Product\Flat\Processor::INDEXER_ID);
             $this->indexerState->setStatus(\Magento\Framework\Indexer\StateInterface::STATUS_INVALID);
             $this->indexerState->save();
         } else {
             $this->_productFlatIndexerProcessor->getIndexer()->setScheduled(false);
         }
     }
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:17,代碼來源:Mode.php

示例3: testAddNewStoreGroup

 /**
  * @magentoDbIsolation enabled
  * @magentoAppIsolation enabled
  * @magentoAppArea adminhtml
  * @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1
  */
 public function testAddNewStoreGroup()
 {
     /** @var \Magento\Store\Model\Group $storeGroup */
     $storeGroup = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Store\\Model\\Group');
     $storeGroup->setData(['website_id' => 1, 'name' => 'New Store Group', 'root_category_id' => 2, 'group_id' => null]);
     $storeGroup->save();
     $this->assertTrue($this->_processor->getIndexer()->isInvalid());
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:14,代碼來源:ProcessorTest.php


注:本文中的Magento\Catalog\Model\Indexer\Product\Flat\Processor::getIndexer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。