Ejemplo n.º 1
0
 /**
  * @param array $data
  * @param array $dataSourceItems
  * @param array $expectedDataSourceItems
  * @param string $expectedUrlPath
  * @param array $expectedUrlParam
  * @dataProvider prepareDataSourceDataProvider
  */
 public function testPrepareDataSource($data, $dataSourceItems, $expectedDataSourceItems, $expectedUrlPath, $expectedUrlParam)
 {
     $this->model = $this->objectManager->getObject('Magento\\Sales\\Ui\\Component\\Listing\\Column\\ViewAction', ['urlBuilder' => $this->urlBuilder, 'data' => $data]);
     $this->urlBuilder->expects($this->once())->method('getUrl')->with($expectedUrlPath, $expectedUrlParam)->willReturn('url');
     $dataSource = ['data' => ['items' => $dataSourceItems]];
     $dataSource = $this->model->prepareDataSource($dataSource);
     $this->assertEquals($expectedDataSourceItems, $dataSource['data']['items']);
 }
Ejemplo n.º 2
0
 /**
  * @param array $data
  * @param array $dataSourceItems
  * @param array $expectedDataSourceItems
  * @param string $expectedUrlPath
  * @param array $expectedUrlParam
  * @dataProvider prepareDataSourceDataProvider
  */
 public function testPrepareDataSource($data, $dataSourceItems, $expectedDataSourceItems, $expectedUrlPath, $expectedUrlParam)
 {
     $contextMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\ContextInterface')->getMockForAbstractClass();
     $processor = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponent\\Processor')->disableOriginalConstructor()->getMock();
     $contextMock->expects($this->any())->method('getProcessor')->willReturn($processor);
     $this->model = $this->objectManager->getObject('Magento\\Sales\\Ui\\Component\\Listing\\Column\\ViewAction', ['urlBuilder' => $this->urlBuilder, 'data' => $data, 'context' => $contextMock]);
     $this->urlBuilder->expects($this->once())->method('getUrl')->with($expectedUrlPath, $expectedUrlParam)->willReturn('url');
     $dataSource = ['data' => ['items' => $dataSourceItems]];
     $dataSource = $this->model->prepareDataSource($dataSource);
     $this->assertEquals($expectedDataSourceItems, $dataSource['data']['items']);
 }