[flutter_tool] Report analytics as disabled when suppressed (#71728)

This commit is contained in:
Zachary Anderson
2020-12-04 11:52:32 -08:00
committed by GitHub
parent a12c22b296
commit cd3aec3660
2 changed files with 24 additions and 1 deletions

View File

@@ -288,6 +288,24 @@ void main() {
}, overrides: <Type, Generator>{
Usage: () => mockUsage,
});
testUsingContext('analytics reported disabled when suppressed', () async {
final ConfigCommand configCommand = ConfigCommand();
final CommandRunner<void> commandRunner = createTestCommandRunner(configCommand);
mockUsage.suppressAnalytics = true;
await commandRunner.run(<String>[
'config',
]);
expect(
testLogger.statusText,
containsIgnoringWhitespace('Analytics reporting is currently disabled'),
);
}, overrides: <Type, Generator>{
Usage: () => mockUsage,
});
});
}
@@ -306,4 +324,7 @@ class MockFlutterVersion extends Mock implements FlutterVersion {}
class MockUsage extends Mock implements Usage {
@override
bool enabled = true;
@override
bool suppressAnalytics = false;
}