Esempio n. 1
0
 public function testPersist()
 {
     $model = new State($this->config, $this->writer);
     $constraint = new \PHPUnit_Framework_Constraint_IsInstanceOf('Magento\\Framework\\App\\Cache\\Type\\ConfigSegment');
     $this->writer->expects($this->once())->method('update')->with($constraint);
     $model->persist();
 }
Esempio n. 2
0
 public function testPersist()
 {
     $model = new State($this->config, $this->writer);
     $this->config->expects($this->once())->method('getConfigData')->willReturn(['test_cache_type' => true]);
     $configValue = [ConfigFilePool::APP_CONFIG => ['cache_types' => ['test_cache_type' => true]]];
     $this->writer->expects($this->once())->method('saveConfig')->with($configValue);
     $model->persist();
 }
Esempio n. 3
0
 protected function generalGetProductCollection()
 {
     $this->eventManager->expects($this->once())->method('dispatch')->will($this->returnValue(true));
     $this->scopeConfig->expects($this->once())->method('getValue')->withAnyParameters()->willReturn(false);
     $this->cacheState->expects($this->atLeastOnce())->method('isEnabled')->withAnyParameters()->willReturn(false);
     $this->catalogConfig->expects($this->once())->method('getProductAttributes')->willReturn([]);
     $this->localDate->expects($this->any())->method('date')->willReturn(new \DateTime('now', new \DateTimeZone('UTC')));
     $this->context->expects($this->once())->method('getEventManager')->willReturn($this->eventManager);
     $this->context->expects($this->once())->method('getScopeConfig')->willReturn($this->scopeConfig);
     $this->context->expects($this->once())->method('getCacheState')->willReturn($this->cacheState);
     $this->context->expects($this->once())->method('getCatalogConfig')->willReturn($this->catalogConfig);
     $this->context->expects($this->once())->method('getLocaleDate')->willReturn($this->localDate);
     $this->productCollection = $this->getMockBuilder('Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection')->setMethods(['setVisibility', 'addMinimalPrice', 'addFinalPrice', 'addTaxPercents', 'addAttributeToSelect', 'addUrlRewrite', 'addStoreFilter', 'addAttributeToSort', 'setPageSize', 'setCurPage', 'addAttributeToFilter'])->disableOriginalConstructor()->getMock();
     $this->productCollection->expects($this->once())->method('setVisibility')->willReturnSelf();
     $this->productCollection->expects($this->once())->method('addMinimalPrice')->willReturnSelf();
     $this->productCollection->expects($this->once())->method('addFinalPrice')->willReturnSelf();
     $this->productCollection->expects($this->once())->method('addTaxPercents')->willReturnSelf();
     $this->productCollection->expects($this->once())->method('addAttributeToSelect')->willReturnSelf();
     $this->productCollection->expects($this->once())->method('addUrlRewrite')->willReturnSelf();
     $this->productCollection->expects($this->once())->method('addStoreFilter')->willReturnSelf();
     $this->productCollection->expects($this->once())->method('addAttributeToSort')->willReturnSelf();
     $this->productCollection->expects($this->atLeastOnce())->method('setCurPage')->willReturnSelf();
     $this->productCollection->expects($this->any())->method('addAttributeToFilter')->willReturnSelf();
 }