/** * 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_order_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->exactly(2))->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_order_grid', [], 1)->will($this->returnValue('sql-query')); $this->assertEquals($this->statementMock, $this->grid->refresh(1, 'fi.field')); }
/** * @covers ::refresh */ public function testRefresh() { $form = []; $form_state = $this->getMock(FormStateInterface::class); $form_state->expects($this->once())->method('setRebuild')->with(TRUE); $this->sut->refresh($form, $form_state); }