Exemplo n.º 1
0
 protected function setUp()
 {
     $this->ratingOptionCollection = $this->getMock('\\Magento\\Review\\Model\\Resource\\Rating\\Option\\Collection', [], [], '', false);
     $this->element = $this->getMock('\\Magento\\Framework\\Data\\Form\\Element\\Text', ['setValue', 'setIsChecked'], [], '', false);
     $this->session = $this->getMock('\\Magento\\Framework\\Session\\Generic', ['getRatingData', 'setRatingData'], [], '', false);
     $this->rating = $this->getMock('\\Magento\\Review\\Model\\Rating', ['getId', 'getRatingCodes'], [], '', false);
     $this->optionRating = $this->getMock('\\Magento\\Review\\Model\\Rating\\Option', [], [], '', false);
     $this->store = $this->getMock('\\Magento\\Store\\Model\\Store', [], [], '', false);
     $this->form = $this->getMock('\\Magento\\Framework\\Data\\Form', [], [], '', false);
     $this->directoryReadInterface = $this->getMock('\\Magento\\Framework\\Filesystem\\Directory\\ReadInterface');
     $this->registry = $this->getMock('\\Magento\\Framework\\Registry');
     $this->formFactory = $this->getMock('\\Magento\\Framework\\Data\\FormFactory', [], [], '', false);
     $this->optionFactory = $this->getMock('\\Magento\\Review\\Model\\Rating\\OptionFactory', ['create'], [], '', false);
     $this->systemStore = $this->getMock('\\Magento\\Store\\Model\\System\\Store', [], [], '', false);
     $this->viewFileSystem = $this->getMock('\\Magento\\Framework\\View\\FileSystem', [], [], '', false);
     $this->fileSystem = $this->getMock('\\Magento\\Framework\\Filesystem', ['getDirectoryRead'], [], '', false);
     $this->rating->expects($this->any())->method('getId')->will($this->returnValue('1'));
     $this->ratingOptionCollection->expects($this->any())->method('addRatingFilter')->will($this->returnSelf());
     $this->ratingOptionCollection->expects($this->any())->method('load')->will($this->returnSelf());
     $this->ratingOptionCollection->expects($this->any())->method('getItems')->will($this->returnValue([$this->optionRating]));
     $this->optionRating->expects($this->any())->method('getResourceCollection')->will($this->returnValue($this->ratingOptionCollection));
     $this->store->expects($this->any())->method('getId')->will($this->returnValue('0'));
     $this->store->expects($this->any())->method('getName')->will($this->returnValue('store_name'));
     $this->element->expects($this->any())->method('setValue')->will($this->returnSelf());
     $this->element->expects($this->any())->method('setIsChecked')->will($this->returnSelf());
     $this->form->expects($this->any())->method('setForm')->will($this->returnSelf());
     $this->form->expects($this->any())->method('addFieldset')->will($this->returnSelf());
     $this->form->expects($this->any())->method('addField')->will($this->returnSelf());
     $this->form->expects($this->any())->method('setRenderer')->will($this->returnSelf());
     $this->optionFactory->expects($this->any())->method('create')->will($this->returnValue($this->optionRating));
     $this->systemStore->expects($this->any())->method('getStoreCollection')->will($this->returnValue(['0' => $this->store]));
     $this->formFactory->expects($this->any())->method('create')->will($this->returnValue($this->form));
     $this->viewFileSystem->expects($this->any())->method('getTemplateFileName')->will($this->returnValue('template_file_name.html'));
     $this->fileSystem->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($this->directoryReadInterface));
     $objectManagerHelper = new ObjectManagerHelper($this);
     $this->block = $objectManagerHelper->getObject('Magento\\Review\\Block\\Adminhtml\\Rating\\Edit\\Tab\\Form', ['registry' => $this->registry, 'formFactory' => $this->formFactory, 'optionFactory' => $this->optionFactory, 'systemStore' => $this->systemStore, 'session' => $this->session, 'viewFileSystem' => $this->viewFileSystem, 'filesystem' => $this->fileSystem]);
 }
Exemplo n.º 2
0
 public function testSetName()
 {
     $this->_qtyMock->expects($this->once())->method('setName')->with(self::ATTRIBUTE_NAME . '[qty]');
     $this->_block->setName(self::ATTRIBUTE_NAME);
 }