Example #1
0
 public function testGetOptionsParsesResultOfProvidedMethodOfSourceModelIfTypeIsNotMultiselect()
 {
     $this->_model->setData(array('source_model' => 'Source_Model_Name::retrieveElements', 'path' => 'path', 'type' => 'select'), 'scope');
     $sourceModelMock = $this->getMock('Magento\\Framework\\Object', array('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(array('var1' => 'val1', 'var2' => array('subvar1' => 'subval1'))));
     $expected = array(array('label' => 'val1', 'value' => 'var1'), array('subvar1' => 'subval1'));
     $this->assertEquals($expected, $this->_model->getOptions());
 }