예제 #1
0
파일: GridTest.php 프로젝트: nja78/magento2
 public function testExecute()
 {
     $layout = $this->getMock('\\Magento\\Framework\\View\\LayoutInterface');
     $block = $this->getMockBuilder('Magento\\Bundle\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Bundle\\Option\\Search\\Grid')->disableOriginalConstructor()->setMethods(['setIndex', 'toHtml'])->getMock();
     $this->response->expects($this->once())->method('setBody')->willReturnSelf();
     $this->request->expects($this->once())->method('getParam')->with('index')->willReturn('index');
     $this->view->expects($this->once())->method('getLayout')->willReturn($layout);
     $layout->expects($this->once())->method('createBlock')->willReturn($block);
     $block->expects($this->once())->method('setIndex')->willReturnSelf();
     $block->expects($this->once())->method('toHtml')->willReturnSelf();
     $this->assertEquals($this->response, $this->controller->execute());
 }
예제 #2
0
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Invalid parameter "index"
  */
 public function testExecuteWithException()
 {
     $this->request->expects($this->once())->method('getParam')->with('index')->willReturn('<index"');
     $this->controller->execute();
 }