22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5+ import 'package:flutter_tools/src/base/user_messages.dart' ;
56import 'package:flutter_tools/src/doctor.dart' ;
67import 'package:flutter_tools/src/macos/xcode.dart' ;
78import 'package:flutter_tools/src/macos/xcode_validator.dart' ;
@@ -17,89 +18,74 @@ class MockXcode extends Mock implements Xcode {}
1718void main () {
1819 group ('Xcode validation' , () {
1920 MockXcode xcode;
20- MockProcessManager processManager;
2121
2222 setUp (() {
2323 xcode = MockXcode ();
24- processManager = MockProcessManager ();
2524 });
2625
27- testUsingContext ('Emits missing status when Xcode is not installed' , () async {
26+ testWithoutContext ('Emits missing status when Xcode is not installed' , () async {
2827 when (xcode.isInstalled).thenReturn (false );
2928 when (xcode.xcodeSelectPath).thenReturn (null );
30- const XcodeValidator validator = XcodeValidator ();
29+ final XcodeValidator validator = XcodeValidator (xcode : xcode, userMessages : UserMessages () );
3130 final ValidationResult result = await validator.validate ();
3231 expect (result.type, ValidationType .missing);
33- }, overrides: < Type , Generator > {
34- Xcode : () => xcode,
3532 });
3633
37- testUsingContext ('Emits missing status when Xcode installation is incomplete' , () async {
34+ testWithoutContext ('Emits missing status when Xcode installation is incomplete' , () async {
3835 when (xcode.isInstalled).thenReturn (false );
3936 when (xcode.xcodeSelectPath).thenReturn ('/Library/Developer/CommandLineTools' );
40- const XcodeValidator validator = XcodeValidator ();
37+ final XcodeValidator validator = XcodeValidator (xcode : xcode, userMessages : UserMessages () );
4138 final ValidationResult result = await validator.validate ();
4239 expect (result.type, ValidationType .missing);
43- }, overrides: < Type , Generator > {
44- Xcode : () => xcode,
4540 });
4641
47- testUsingContext ('Emits partial status when Xcode version too low' , () async {
42+ testWithoutContext ('Emits partial status when Xcode version too low' , () async {
4843 when (xcode.isInstalled).thenReturn (true );
4944 when (xcode.versionText)
5045 .thenReturn ('Xcode 7.0.1\n Build version 7C1002\n ' );
5146 when (xcode.isInstalledAndMeetsVersionCheck).thenReturn (false );
5247 when (xcode.eulaSigned).thenReturn (true );
5348 when (xcode.isSimctlInstalled).thenReturn (true );
54- const XcodeValidator validator = XcodeValidator ();
49+ final XcodeValidator validator = XcodeValidator (xcode : xcode, userMessages : UserMessages () );
5550 final ValidationResult result = await validator.validate ();
5651 expect (result.type, ValidationType .partial);
57- }, overrides: < Type , Generator > {
58- Xcode : () => xcode,
5952 });
6053
61- testUsingContext ('Emits partial status when Xcode EULA not signed' , () async {
54+ testWithoutContext ('Emits partial status when Xcode EULA not signed' , () async {
6255 when (xcode.isInstalled).thenReturn (true );
6356 when (xcode.versionText)
6457 .thenReturn ('Xcode 8.2.1\n Build version 8C1002\n ' );
6558 when (xcode.isInstalledAndMeetsVersionCheck).thenReturn (true );
6659 when (xcode.eulaSigned).thenReturn (false );
6760 when (xcode.isSimctlInstalled).thenReturn (true );
68- const XcodeValidator validator = XcodeValidator ();
61+ final XcodeValidator validator = XcodeValidator (xcode : xcode, userMessages : UserMessages () );
6962 final ValidationResult result = await validator.validate ();
7063 expect (result.type, ValidationType .partial);
71- }, overrides: < Type , Generator > {
72- Xcode : () => xcode,
7364 });
7465
75- testUsingContext ('Emits partial status when simctl is not installed' , () async {
66+ testWithoutContext ('Emits partial status when simctl is not installed' , () async {
7667 when (xcode.isInstalled).thenReturn (true );
7768 when (xcode.versionText)
7869 .thenReturn ('Xcode 8.2.1\n Build version 8C1002\n ' );
7970 when (xcode.isInstalledAndMeetsVersionCheck).thenReturn (true );
8071 when (xcode.eulaSigned).thenReturn (true );
8172 when (xcode.isSimctlInstalled).thenReturn (false );
82- const XcodeValidator validator = XcodeValidator ();
73+ final XcodeValidator validator = XcodeValidator (xcode : xcode, userMessages : UserMessages () );
8374 final ValidationResult result = await validator.validate ();
8475 expect (result.type, ValidationType .partial);
85- }, overrides: < Type , Generator > {
86- Xcode : () => xcode,
8776 });
8877
8978
90- testUsingContext ('Succeeds when all checks pass' , () async {
79+ testWithoutContext ('Succeeds when all checks pass' , () async {
9180 when (xcode.isInstalled).thenReturn (true );
9281 when (xcode.versionText)
9382 .thenReturn ('Xcode 8.2.1\n Build version 8C1002\n ' );
9483 when (xcode.isInstalledAndMeetsVersionCheck).thenReturn (true );
9584 when (xcode.eulaSigned).thenReturn (true );
9685 when (xcode.isSimctlInstalled).thenReturn (true );
97- const XcodeValidator validator = XcodeValidator ();
86+ final XcodeValidator validator = XcodeValidator (xcode : xcode, userMessages : UserMessages () );
9887 final ValidationResult result = await validator.validate ();
9988 expect (result.type, ValidationType .installed);
100- }, overrides: < Type , Generator > {
101- Xcode : () => xcode,
102- ProcessManager : () => processManager,
10389 });
10490 });
10591}
0 commit comments