Beispiel #1
0
 public function testGetOptionsParsesResultOfProvidedMethodOfSourceModelIfTypeIsNotMultiselect()
 {
     $this->_model->setData(['source_model' => 'Source_Model_Name::retrieveElements', 'path' => 'path', 'type' => 'select'], 'scope');
     $sourceModelMock = $this->getMock('Magento\\Framework\\Object', ['setPath', 'retrieveElements']);
     $this->_sourceFactoryMock->expects($this->once())->method('create')->with('Source_Model_Name')->will($this->returnValue($sourceModelMock));
     $sourceModelMock->expects($this->once())->method('setPath')->with('path/');
     $sourceModelMock->expects($this->once())->method('retrieveElements')->will($this->returnValue(['var1' => 'val1', 'var2' => ['subvar1' => 'subval1']]));
     $expected = [['label' => 'val1', 'value' => 'var1'], ['subvar1' => 'subval1']];
     $this->assertEquals($expected, $this->_model->getOptions());
 }
 /**
  * {@inheritdoc}
  */
 public function getOptions()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getOptions');
     if (!$pluginInfo) {
         return parent::getOptions();
     } else {
         return $this->___callPlugins('getOptions', func_get_args(), $pluginInfo);
     }
 }