Pantheon\Terminus\UnitTests\Commands\Backup\RestoreCommandTest::testRestoreBackupWithFileFails PHP Method

testRestoreBackupWithFileFails() public method

Tests the backup:restore command with file when the restoration is unsuccessful
    public function testRestoreBackupWithFileFails()
    {
        $this->environment->id = 'env_id';
        $test_filename = 'test.tar.gz';
        $message = 'Successfully queued restore_site';
        $this->backups->expects($this->once())->method('getBackupByFileName')->with($test_filename)->willReturn($this->backup);
        $this->backup->expects($this->once())->method('restore')->willReturn($this->workflow);
        $this->workflow->expects($this->once())->method('wait')->with();
        $this->workflow->expects($this->once())->method('isSuccessful')->with()->willReturn(false);
        $this->logger->expects($this->never())->method('log');
        $this->workflow->expects($this->once())->method('getMessage')->with()->willReturn($message);
        $this->setExpectedException(TerminusException::class);
        $out = $this->command->restoreBackup("mysite.{$this->environment->id}", ['file' => $test_filename]);
        $this->assertNull($out);
    }