Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ce9aee66
Unverified
Commit
ce9aee66
authored
Apr 30, 2021
by
Jonah Williams
Committed by
GitHub
Apr 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove mocks from xcode test (#81451)
parent
8c453861
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
40 deletions
+45
-40
xcode_test.dart
...es/flutter_tools/test/general.shard/macos/xcode_test.dart
+45
-40
No files found.
packages/flutter_tools/test/general.shard/macos/xcode_test.dart
View file @
ce9aee66
...
...
@@ -18,7 +18,7 @@ import 'package:flutter_tools/src/ios/iproxy.dart';
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
import
'package:flutter_tools/src/macos/xcdevice.dart'
;
import
'package:flutter_tools/src/macos/xcode.dart'
;
import
'package:
mockito/mockito
.dart'
;
import
'package:
test/fake
.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
...
...
@@ -38,24 +38,23 @@ void main() {
});
group
(
'Xcode'
,
()
{
MockXcodeProjectInterpreter
mockX
codeProjectInterpreter
;
FakeXcodeProjectInterpreter
x
codeProjectInterpreter
;
setUp
(()
{
mockXcodeProjectInterpreter
=
Mock
XcodeProjectInterpreter
();
xcodeProjectInterpreter
=
Fake
XcodeProjectInterpreter
();
});
testWithoutContext
(
'isInstalledAndMeetsVersionCheck is false when not macOS'
,
()
{
final
Xcode
xcode
=
Xcode
.
test
(
platform:
FakePlatform
(
operatingSystem:
'windows'
),
processManager:
fakeProcessManager
,
xcodeProjectInterpreter:
mockX
codeProjectInterpreter
,
xcodeProjectInterpreter:
x
codeProjectInterpreter
,
);
expect
(
xcode
.
isInstalledAndMeetsVersionCheck
,
isFalse
);
});
testWithoutContext
(
'isSimctlInstalled is true when simctl list succeeds'
,
()
{
when
(
mockXcodeProjectInterpreter
.
xcrunCommand
()).
thenReturn
(<
String
>[
'xcrun'
]);
fakeProcessManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
...
...
@@ -67,7 +66,7 @@ void main() {
);
final
Xcode
xcode
=
Xcode
.
test
(
processManager:
fakeProcessManager
,
xcodeProjectInterpreter:
mockX
codeProjectInterpreter
,
xcodeProjectInterpreter:
x
codeProjectInterpreter
,
);
expect
(
xcode
.
isSimctlInstalled
,
isTrue
);
...
...
@@ -75,7 +74,6 @@ void main() {
});
testWithoutContext
(
'isSimctlInstalled is true when simctl list fails'
,
()
{
when
(
mockXcodeProjectInterpreter
.
xcrunCommand
()).
thenReturn
(<
String
>[
'xcrun'
]);
fakeProcessManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
...
...
@@ -88,7 +86,7 @@ void main() {
);
final
Xcode
xcode
=
Xcode
.
test
(
processManager:
fakeProcessManager
,
xcodeProjectInterpreter:
mockX
codeProjectInterpreter
,
xcodeProjectInterpreter:
x
codeProjectInterpreter
,
);
expect
(
xcode
.
isSimctlInstalled
,
isFalse
);
...
...
@@ -99,11 +97,10 @@ void main() {
Xcode
xcode
;
setUp
(()
{
mockXcodeProjectInterpreter
=
MockXcodeProjectInterpreter
();
when
(
mockXcodeProjectInterpreter
.
xcrunCommand
()).
thenReturn
(<
String
>[
'xcrun'
]);
xcodeProjectInterpreter
=
FakeXcodeProjectInterpreter
();
xcode
=
Xcode
.
test
(
processManager:
fakeProcessManager
,
xcodeProjectInterpreter:
mockX
codeProjectInterpreter
,
xcodeProjectInterpreter:
x
codeProjectInterpreter
,
);
});
...
...
@@ -137,105 +134,105 @@ void main() {
});
testWithoutContext
(
'xcodeVersionSatisfactory is false when version is less than minimum'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
9
,
0
,
0
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
9
,
0
,
0
);
expect
(
xcode
.
isRequiredVersionSatisfactory
,
isFalse
);
});
testWithoutContext
(
'xcodeVersionSatisfactory is false when xcodebuild tools are not installed'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
false
)
;
xcodeProjectInterpreter
.
isInstalled
=
false
;
expect
(
xcode
.
isRequiredVersionSatisfactory
,
isFalse
);
});
testWithoutContext
(
'xcodeVersionSatisfactory is true when version meets minimum'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
12
,
0
,
1
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
12
,
0
,
1
);
expect
(
xcode
.
isRequiredVersionSatisfactory
,
isTrue
);
});
testWithoutContext
(
'xcodeVersionSatisfactory is true when major version exceeds minimum'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
13
,
0
,
0
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
13
,
0
,
0
);
expect
(
xcode
.
isRequiredVersionSatisfactory
,
isTrue
);
});
testWithoutContext
(
'xcodeVersionSatisfactory is true when minor version exceeds minimum'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
12
,
3
,
0
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
12
,
3
,
0
);
expect
(
xcode
.
isRequiredVersionSatisfactory
,
isTrue
);
});
testWithoutContext
(
'xcodeVersionSatisfactory is true when patch version exceeds minimum'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
12
,
0
,
2
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
12
,
0
,
2
);
expect
(
xcode
.
isRequiredVersionSatisfactory
,
isTrue
);
});
testWithoutContext
(
'isRecommendedVersionSatisfactory is false when version is less than minimum'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
11
,
0
,
0
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
11
,
0
,
0
);
expect
(
xcode
.
isRecommendedVersionSatisfactory
,
isFalse
);
});
testWithoutContext
(
'isRecommendedVersionSatisfactory is false when xcodebuild tools are not installed'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
false
)
;
xcodeProjectInterpreter
.
isInstalled
=
false
;
expect
(
xcode
.
isRecommendedVersionSatisfactory
,
isFalse
);
});
testWithoutContext
(
'isRecommendedVersionSatisfactory is true when version meets minimum'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
12
,
0
,
1
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
12
,
0
,
1
);
expect
(
xcode
.
isRecommendedVersionSatisfactory
,
isTrue
);
});
testWithoutContext
(
'isRecommendedVersionSatisfactory is true when major version exceeds minimum'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
13
,
0
,
0
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
13
,
0
,
0
);
expect
(
xcode
.
isRecommendedVersionSatisfactory
,
isTrue
);
});
testWithoutContext
(
'isRecommendedVersionSatisfactory is true when minor version exceeds minimum'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
12
,
3
,
0
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
12
,
3
,
0
);
expect
(
xcode
.
isRecommendedVersionSatisfactory
,
isTrue
);
});
testWithoutContext
(
'isRecommendedVersionSatisfactory is true when patch version exceeds minimum'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
12
,
0
,
2
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
12
,
0
,
2
);
expect
(
xcode
.
isRecommendedVersionSatisfactory
,
isTrue
);
});
testWithoutContext
(
'isInstalledAndMeetsVersionCheck is false when not installed'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
false
)
;
xcodeProjectInterpreter
.
isInstalled
=
false
;
expect
(
xcode
.
isInstalledAndMeetsVersionCheck
,
isFalse
);
expect
(
fakeProcessManager
.
hasRemainingExpectations
,
isFalse
);
});
testWithoutContext
(
'isInstalledAndMeetsVersionCheck is false when version not satisfied'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
10
,
2
,
0
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
10
,
2
,
0
);
expect
(
xcode
.
isInstalledAndMeetsVersionCheck
,
isFalse
);
expect
(
fakeProcessManager
.
hasRemainingExpectations
,
isFalse
);
});
testWithoutContext
(
'isInstalledAndMeetsVersionCheck is true when macOS and installed and version is satisfied'
,
()
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
true
)
;
when
(
mockXcodeProjectInterpreter
.
version
).
thenReturn
(
Version
(
12
,
0
,
1
)
);
xcodeProjectInterpreter
.
isInstalled
=
true
;
xcodeProjectInterpreter
.
version
=
Version
(
12
,
0
,
1
);
expect
(
xcode
.
isInstalledAndMeetsVersionCheck
,
isTrue
);
expect
(
fakeProcessManager
.
hasRemainingExpectations
,
isFalse
);
...
...
@@ -256,7 +253,6 @@ void main() {
});
testWithoutContext
(
'eulaSigned is false when clang is not installed'
,
()
{
when
(
mockXcodeProjectInterpreter
.
xcrunCommand
()).
thenReturn
(<
String
>[
'xcrun'
]);
fakeProcessManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
'xcrun'
,
'clang'
],
...
...
@@ -785,4 +781,13 @@ void main() {
});
}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
class
FakeXcodeProjectInterpreter
extends
Fake
implements
XcodeProjectInterpreter
{
@override
Version
version
=
Version
.
unknown
;
@override
bool
isInstalled
=
false
;
@override
List
<
String
>
xcrunCommand
()
=>
<
String
>[
'xcrun'
];
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment