[flutter_plugin_tools] Move publish tests to RecordingProcessRunner (#4269)

Replaces almost all of the `TestProcessRunner`, which was specific to the `publish` tests, with the repo-standard `RecordingProcessRunner` (which now has most of the capabilities these tests need). This finishes aligning these tests with the rest of the repository tests, so they will be easier to maintain as part of the overall repository.

To support this, `RecordingProcessRunner` was modified slightly to return a succeeding, no-output process by default for `start`. That makes it consistent with its existing `run` behavior, so is a good change in general.
This commit is contained in:
stuartmorgan
2021-08-26 15:05:28 -04:00
committed by GitHub
parent 419cbe7354
commit e7ef3168bf
3 changed files with 152 additions and 203 deletions

View File

@ -17,6 +17,8 @@ import 'package:path/path.dart' as p;
import 'package:platform/platform.dart';
import 'package:quiver/collection.dart';
import 'mocks.dart';
/// Returns the exe name that command will use when running Flutter on
/// [platform].
String getFlutterCommand(Platform platform) =>
@ -320,7 +322,8 @@ class RecordingProcessRunner extends ProcessRunner {
Future<io.Process> start(String executable, List<String> args,
{Directory? workingDirectory}) async {
recordedCalls.add(ProcessCall(executable, args, workingDirectory?.path));
return Future<io.Process>.value(_getProcessToReturn(executable));
return Future<io.Process>.value(
_getProcessToReturn(executable) ?? MockProcess());
}
io.Process? _getProcessToReturn(String executable) {