public function testRollbackDocument() { $documentName = 'document_name'; $backupDocumentName = 'migration_backup_document_name'; $select = $this->getMockBuilder('\\Magento\\Framework\\DB\\Select')->disableOriginalConstructor()->setMethods(['from'])->getMock(); $select->expects($this->once())->method('from')->with($backupDocumentName)->willReturn($select); $this->pdoMysql->expects($this->once())->method('isTableExists')->willReturn(true); $this->pdoMysql->expects($this->once())->method('truncateTable')->with($documentName); $this->pdoMysql->expects($this->once())->method('select')->willReturn($select); $this->pdoMysql->expects($this->once())->method('insertFromSelect')->with($select, $documentName)->willReturn('select query'); $this->pdoMysql->expects($this->once())->method('query')->with('select query'); $this->pdoMysql->expects($this->once())->method('dropTable')->with($backupDocumentName); $this->adapterMysql->rollbackDocument($documentName); }