コード例 #1
0
ファイル: SetTest.php プロジェクト: shabbirvividads/magento2
 /**
  * @return void
  */
 public function testGetSetInfoCacheHit()
 {
     $cached = [1 => [10000 => ['group_id' => 10, 'group_sort' => 100, 'sort' => 1000]]];
     $this->resourceMock->expects($this->never())->method('getConnection');
     $this->eavConfigMock->expects($this->any())->method('isCacheEnabled')->willReturn(true);
     $cacheMock = $this->getMockBuilder('Magento\\Framework\\App\\CacheInterface')->disableOriginalConstructor()->setMethods(['load', 'save', 'getFrontend', 'remove', 'clean'])->getMock();
     $cacheMock->expects($this->once())->method('load')->with(Set::ATTRIBUTES_CACHE_ID . 1)->willReturn(serialize($cached));
     $this->eavConfigMock->expects($this->any())->method('getCache')->willReturn($cacheMock);
     $this->assertEquals([1 => [10000 => ['group_id' => 10, 'group_sort' => 100, 'sort' => 1000]], 2 => [], 3 => []], $this->model->getSetInfo([1, 2, 3], 1));
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function delete(AttributeSetInterface $attributeSet)
 {
     try {
         $this->attributeSetResource->delete($attributeSet);
     } catch (\Magento\Framework\Exception\StateException $exception) {
         throw new CouldNotDeleteException(__('Default attribute set can not be deleted'));
     } catch (\Exception $exception) {
         throw new CouldNotDeleteException(__('There was an error deleting attribute set.'));
     }
     return true;
 }