Unverified Commit 9236eefd authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

MockPub -> FakePub (#75759)

parent fb2b98f9
...@@ -23,6 +23,7 @@ import 'package:mockito/mockito.dart'; ...@@ -23,6 +23,7 @@ import 'package:mockito/mockito.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/fakes.dart';
import '../../src/testbed.dart'; import '../../src/testbed.dart';
void main() { void main() {
...@@ -65,7 +66,7 @@ void main() { ...@@ -65,7 +66,7 @@ void main() {
Platform: () => fakePlatform, Platform: () => fakePlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true), FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
Pub: () => MockPub(), Pub: () => FakePub(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -78,7 +79,7 @@ void main() { ...@@ -78,7 +79,7 @@ void main() {
Platform: () => fakePlatform, Platform: () => fakePlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true), FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
Pub: () => MockPub(), Pub: () => FakePub(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -93,7 +94,7 @@ void main() { ...@@ -93,7 +94,7 @@ void main() {
Platform: () => fakePlatform, Platform: () => fakePlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
FeatureFlags: () => TestFeatureFlags(isWebEnabled: false), FeatureFlags: () => TestFeatureFlags(isWebEnabled: false),
Pub: () => MockPub(), Pub: () => FakePub(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -108,7 +109,7 @@ void main() { ...@@ -108,7 +109,7 @@ void main() {
Platform: () => fakePlatform, Platform: () => fakePlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true), FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
Pub: () => MockPub(), Pub: () => FakePub(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
BuildSystem: () => MockBuildSystem(), BuildSystem: () => MockBuildSystem(),
}); });
...@@ -119,7 +120,7 @@ void main() { ...@@ -119,7 +120,7 @@ void main() {
Platform: () => fakePlatform, Platform: () => fakePlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
FeatureFlags: () => TestFeatureFlags(isWebEnabled: false), FeatureFlags: () => TestFeatureFlags(isWebEnabled: false),
Pub: () => MockPub(), Pub: () => FakePub(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -129,7 +130,7 @@ void main() { ...@@ -129,7 +130,7 @@ void main() {
Platform: () => fakePlatform, Platform: () => fakePlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true), FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
Pub: () => MockPub(), Pub: () => FakePub(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
...@@ -145,7 +146,7 @@ void main() { ...@@ -145,7 +146,7 @@ void main() {
Platform: () => fakePlatform, Platform: () => fakePlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true), FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
Pub: () => MockPub(), Pub: () => FakePub(),
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
BuildSystem: () => MockBuildSystem(), BuildSystem: () => MockBuildSystem(),
}); });
...@@ -208,7 +209,6 @@ class UrlLauncherPlugin {} ...@@ -208,7 +209,6 @@ class UrlLauncherPlugin {}
} }
class MockBuildSystem extends Mock implements BuildSystem {} class MockBuildSystem extends Mock implements BuildSystem {}
class MockPub extends Mock implements Pub {}
class TestWebBuildCommand extends FlutterCommand { class TestWebBuildCommand extends FlutterCommand {
TestWebBuildCommand({ bool verboseHelp = false }) : TestWebBuildCommand({ bool verboseHelp = false }) :
......
...@@ -27,6 +27,7 @@ import 'package:vm_service/vm_service.dart'; ...@@ -27,6 +27,7 @@ import 'package:vm_service/vm_service.dart';
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/fakes.dart';
import '../src/testbed.dart'; import '../src/testbed.dart';
void main() { void main() {
...@@ -58,7 +59,7 @@ void main() { ...@@ -58,7 +59,7 @@ void main() {
urlTunneller: null, urlTunneller: null,
) as ResidentWebRunner; ) as ResidentWebRunner;
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Pub: () => MockPub(), Pub: () => FakePub(),
} }
); );
}); });
...@@ -201,5 +202,4 @@ class MockChromeConnection extends Mock implements ChromeConnection {} ...@@ -201,5 +202,4 @@ class MockChromeConnection extends Mock implements ChromeConnection {}
class MockChromeTab extends Mock implements ChromeTab {} class MockChromeTab extends Mock implements ChromeTab {}
class MockWipConnection extends Mock implements WipConnection {} class MockWipConnection extends Mock implements WipConnection {}
class MockBuildSystem extends Mock implements BuildSystem {} class MockBuildSystem extends Mock implements BuildSystem {}
class MockPub extends Mock implements Pub {}
class MockChromiumLauncher extends Mock implements ChromiumLauncher {} class MockChromiumLauncher extends Mock implements ChromiumLauncher {}
...@@ -25,6 +25,7 @@ import 'package:mockito/mockito.dart'; ...@@ -25,6 +25,7 @@ import 'package:mockito/mockito.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/fakes.dart';
import 'utils.dart'; import 'utils.dart';
void main() { void main() {
...@@ -672,20 +673,6 @@ class FakeSignals implements Signals { ...@@ -672,20 +673,6 @@ class FakeSignals implements Signals {
Stream<Object> get errors => delegate.errors; Stream<Object> get errors => delegate.errors;
} }
class FakePub extends Fake implements Pub {
@override
Future<void> get({
PubContext context,
String directory,
bool skipIfAbsent = false,
bool upgrade = false,
bool offline = false,
bool generateSyntheticPackage = false,
String flutterRootOverride,
bool checkUpToDate = false,
}) async { }
}
class FakeClock extends Fake implements SystemClock { class FakeClock extends Fake implements SystemClock {
List<int> times = <int>[]; List<int> times = <int>[];
......
...@@ -14,8 +14,10 @@ import 'package:flutter_tools/src/base/logger.dart'; ...@@ -14,8 +14,10 @@ import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/os.dart'; import 'package:flutter_tools/src/base/os.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/dart/pub.dart';
import 'package:flutter_tools/src/device.dart'; import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/ios/plist_parser.dart'; import 'package:flutter_tools/src/ios/plist_parser.dart';
import 'package:test/fake.dart';
/// A fake implementation of the [DeviceLogReader]. /// A fake implementation of the [DeviceLogReader].
class FakeDeviceLogReader extends DeviceLogReader { class FakeDeviceLogReader extends DeviceLogReader {
...@@ -427,3 +429,17 @@ class FakeBotDetector implements BotDetector { ...@@ -427,3 +429,17 @@ class FakeBotDetector implements BotDetector {
final bool _isRunningOnBot; final bool _isRunningOnBot;
} }
class FakePub extends Fake implements Pub {
@override
Future<void> get({
PubContext context,
String directory,
bool skipIfAbsent = false,
bool upgrade = false,
bool offline = false,
bool generateSyntheticPackage = false,
String flutterRootOverride,
bool checkUpToDate = false,
}) async { }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment