Esempio n. 1
0
 /**
  * Test refresh method
  */
 public function testRefresh()
 {
     $this->appResourceMock->expects($this->once())->method('getConnection')->will($this->returnValue($this->adapterMock));
     $this->appResourceMock->expects($this->any())->method('getTableName')->will($this->returnValue('sales_creditmemo_grid'));
     $this->adapterMock->expects($this->once())->method('select')->will($this->returnValue($this->selectMock));
     $this->selectMock->expects($this->once())->method('from')->will($this->returnSelf());
     $this->selectMock->expects($this->once())->method('join')->will($this->returnSelf());
     $this->selectMock->expects($this->once())->method('joinLeft')->will($this->returnSelf());
     $this->selectMock->expects($this->once())->method('columns')->will($this->returnSelf());
     $this->selectMock->expects($this->once())->method('where')->with('fi.field = ?', 1, null)->will($this->returnSelf());
     $this->adapterMock->expects($this->once())->method('query')->with('sql-query')->will($this->returnValue($this->statementMock));
     $this->adapterMock->expects($this->once())->method('insertFromSelect')->with($this->selectMock, 'sales_creditmemo_grid', [], 1)->will($this->returnValue('sql-query'));
     $this->assertEquals($this->statementMock, $this->grid->refresh(1, 'fi.field'));
 }