コード例 #1
0
 /**
  * @return array
  */
 protected function getSampleColumn()
 {
     $sampleContainer['arguments']['data']['config'] = ['componentType' => Container::NAME, 'formElement' => Container::NAME, 'component' => 'Magento_Ui/js/form/components/group', 'label' => __('File'), 'dataScope' => ''];
     $sampleType['arguments']['data']['config'] = ['formElement' => Form\Element\Select::NAME, 'componentType' => Form\Field::NAME, 'component' => 'Magento_Downloadable/js/components/upload-type-handler', 'dataType' => Form\Element\DataType\Text::NAME, 'dataScope' => 'type', 'options' => $this->typeUpload->toOptionArray(), 'typeFile' => 'sample_file', 'typeUrl' => 'sample_url'];
     $sampleUrl['arguments']['data']['config'] = ['formElement' => Form\Element\Input::NAME, 'componentType' => Form\Field::NAME, 'dataType' => Form\Element\DataType\Text::NAME, 'dataScope' => 'sample_url', 'placeholder' => 'URL', 'validation' => ['required-entry' => true, 'validate-url' => true]];
     $sampleUploader['arguments']['data']['config'] = ['formElement' => 'fileUploader', 'componentType' => 'fileUploader', 'component' => 'Magento_Downloadable/js/components/file-uploader', 'elementTmpl' => 'Magento_Downloadable/components/file-uploader', 'fileInputName' => 'samples', 'uploaderConfig' => ['url' => $this->urlBuilder->addSessionParam()->getUrl('adminhtml/downloadable_file/upload', ['type' => 'samples', '_secure' => true])], 'dataScope' => 'file', 'validation' => ['required-entry' => true]];
     return $this->arrayManager->set('children', $sampleContainer, ['sample_type' => $sampleType, 'sample_url' => $sampleUrl, 'sample_file' => $sampleUploader]);
 }
コード例 #2
0
 /**
  * @return void
  */
 public function testModifyMeta()
 {
     $this->locatorMock->expects($this->once())->method('getProduct')->willReturn($this->productMock);
     $this->productMock->expects($this->once())->method('getTypeId');
     $this->storeManagerMock->expects($this->once())->method('isSingleStoreMode');
     $this->typeUploadMock->expects($this->once())->method('toOptionArray');
     $this->urlBuilderMock->expects($this->once())->method('addSessionParam')->willReturnSelf();
     $this->urlBuilderMock->expects($this->once())->method('getUrl');
     $this->arrayManagerMock->expects($this->exactly(6))->method('set')->willReturn([]);
     $this->assertEquals([], $this->samples->modifyMeta([]));
 }
コード例 #3
0
 /**
  * @return void
  */
 public function testModifyMeta()
 {
     $this->locatorMock->expects($this->once())->method('getProduct')->willReturn($this->productMock);
     $this->productMock->expects($this->any())->method('getTypeId');
     $this->storeManagerMock->expects($this->exactly(2))->method('isSingleStoreMode');
     $this->typeUploadMock->expects($this->exactly(2))->method('toOptionArray');
     $this->shareableMock->expects($this->once())->method('toOptionArray');
     $this->urlBuilderMock->expects($this->exactly(2))->method('addSessionParam')->willReturnSelf();
     $this->urlBuilderMock->expects($this->exactly(2))->method('getUrl');
     $currencyMock = $this->getMock(\Magento\Directory\Model\Currency::class, [], [], '', false);
     $currencyMock->expects($this->once())->method('getCurrencySymbol');
     $storeMock = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class)->setMethods(['getBaseCurrency'])->getMockForAbstractClass();
     $storeMock->expects($this->once())->method('getBaseCurrency')->willReturn($currencyMock);
     $this->locatorMock->expects($this->once())->method('getStore')->willReturn($storeMock);
     $this->arrayManagerMock->expects($this->exactly(9))->method('set')->willReturn([]);
     $this->assertEquals([], $this->links->modifyMeta([]));
 }