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
8b144544
Unverified
Commit
8b144544
authored
Mar 15, 2021
by
Jenn Magder
Committed by
GitHub
Mar 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove MockFlutterVersion from mocks (#78089)
parent
c94648f9
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
68 deletions
+62
-68
downgrade_test.dart
...er_tools/test/commands.shard/hermetic/downgrade_test.dart
+15
-17
upgrade_test.dart
...ter_tools/test/commands.shard/permeable/upgrade_test.dart
+47
-49
mocks.dart
packages/flutter_tools/test/src/mocks.dart
+0
-2
No files found.
packages/flutter_tools/test/commands.shard/hermetic/downgrade_test.dart
View file @
8b144544
...
@@ -12,12 +12,11 @@ import 'package:flutter_tools/src/base/terminal.dart';
...
@@ -12,12 +12,11 @@ import 'package:flutter_tools/src/base/terminal.dart';
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/downgrade.dart'
;
import
'package:flutter_tools/src/commands/downgrade.dart'
;
import
'package:flutter_tools/src/persistent_tool_state.dart'
;
import
'package:flutter_tools/src/persistent_tool_state.dart'
;
import
'package:flutter_tools/src/version.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:mockito/mockito.dart'
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/context.dart'
;
import
'../../src/
mock
s.dart'
;
import
'../../src/
fake
s.dart'
;
void
main
(
)
{
void
main
(
)
{
FileSystem
fileSystem
;
FileSystem
fileSystem
;
...
@@ -25,7 +24,6 @@ void main() {
...
@@ -25,7 +24,6 @@ void main() {
AnsiTerminal
terminal
;
AnsiTerminal
terminal
;
ProcessManager
processManager
;
ProcessManager
processManager
;
MockStdio
mockStdio
;
MockStdio
mockStdio
;
FlutterVersion
flutterVersion
;
setUpAll
(()
{
setUpAll
(()
{
Cache
.
disableLocking
();
Cache
.
disableLocking
();
...
@@ -36,7 +34,6 @@ void main() {
...
@@ -36,7 +34,6 @@ void main() {
});
});
setUp
(()
{
setUp
(()
{
flutterVersion
=
MockFlutterVersion
();
mockStdio
=
MockStdio
();
mockStdio
=
MockStdio
();
processManager
=
FakeProcessManager
.
any
();
processManager
=
FakeProcessManager
.
any
();
terminal
=
MockTerminal
();
terminal
=
MockTerminal
();
...
@@ -45,6 +42,7 @@ void main() {
...
@@ -45,6 +42,7 @@ void main() {
});
});
testUsingContext
(
'Downgrade exits on unknown channel'
,
()
async
{
testUsingContext
(
'Downgrade exits on unknown channel'
,
()
async
{
final
FakeFlutterVersion
fakeFlutterVersion
=
FakeFlutterVersion
(
channel:
'unknown'
);
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
.
writeAsStringSync
(
'{"last-active-master-version":"invalid"}'
);
.
writeAsStringSync
(
'{"last-active-master-version":"invalid"}'
);
final
DowngradeCommand
command
=
DowngradeCommand
(
final
DowngradeCommand
command
=
DowngradeCommand
(
...
@@ -52,7 +50,7 @@ void main() {
...
@@ -52,7 +50,7 @@ void main() {
processManager:
processManager
,
processManager:
processManager
,
terminal:
terminal
,
terminal:
terminal
,
stdio:
mockStdio
,
stdio:
mockStdio
,
flutterVersion:
flutterVersion
,
flutterVersion:
f
akeF
lutterVersion
,
logger:
bufferLogger
,
logger:
bufferLogger
,
);
);
...
@@ -61,7 +59,7 @@ void main() {
...
@@ -61,7 +59,7 @@ void main() {
});
});
testUsingContext
(
'Downgrade exits on no recorded version'
,
()
async
{
testUsingContext
(
'Downgrade exits on no recorded version'
,
()
async
{
when
(
flutterVersion
.
channel
).
thenReturn
(
'dev'
);
final
FakeFlutterVersion
fakeFlutterVersion
=
FakeFlutterVersion
(
channel:
'dev'
);
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
.
writeAsStringSync
(
'{"last-active-master-version":"abcd"}'
);
.
writeAsStringSync
(
'{"last-active-master-version":"abcd"}'
);
final
DowngradeCommand
command
=
DowngradeCommand
(
final
DowngradeCommand
command
=
DowngradeCommand
(
...
@@ -77,7 +75,7 @@ void main() {
...
@@ -77,7 +75,7 @@ void main() {
]),
]),
terminal:
terminal
,
terminal:
terminal
,
stdio:
mockStdio
,
stdio:
mockStdio
,
flutterVersion:
flutterVersion
,
flutterVersion:
f
akeF
lutterVersion
,
logger:
bufferLogger
,
logger:
bufferLogger
,
);
);
...
@@ -90,7 +88,7 @@ void main() {
...
@@ -90,7 +88,7 @@ void main() {
});
});
testUsingContext
(
'Downgrade exits on unknown recorded version'
,
()
async
{
testUsingContext
(
'Downgrade exits on unknown recorded version'
,
()
async
{
when
(
flutterVersion
.
channel
).
thenReturn
(
'master'
);
final
FakeFlutterVersion
fakeFlutterVersion
=
FakeFlutterVersion
(
channel:
'master'
);
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
.
writeAsStringSync
(
'{"last-active-master-version":"invalid"}'
);
.
writeAsStringSync
(
'{"last-active-master-version":"invalid"}'
);
final
DowngradeCommand
command
=
DowngradeCommand
(
final
DowngradeCommand
command
=
DowngradeCommand
(
...
@@ -105,7 +103,7 @@ void main() {
...
@@ -105,7 +103,7 @@ void main() {
]),
]),
terminal:
terminal
,
terminal:
terminal
,
stdio:
mockStdio
,
stdio:
mockStdio
,
flutterVersion:
flutterVersion
,
flutterVersion:
f
akeF
lutterVersion
,
logger:
bufferLogger
,
logger:
bufferLogger
,
);
);
...
@@ -114,7 +112,7 @@ void main() {
...
@@ -114,7 +112,7 @@ void main() {
});
});
testUsingContext
(
'Downgrade prompts for user input when terminal is attached - y'
,
()
async
{
testUsingContext
(
'Downgrade prompts for user input when terminal is attached - y'
,
()
async
{
when
(
flutterVersion
.
channel
).
thenReturn
(
'master'
);
final
FakeFlutterVersion
fakeFlutterVersion
=
FakeFlutterVersion
(
channel:
'master'
);
when
(
mockStdio
.
hasTerminal
).
thenReturn
(
true
);
when
(
mockStdio
.
hasTerminal
).
thenReturn
(
true
);
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
.
writeAsStringSync
(
'{"last-active-master-version":"g6b00b5e88"}'
);
.
writeAsStringSync
(
'{"last-active-master-version":"g6b00b5e88"}'
);
...
@@ -123,7 +121,7 @@ void main() {
...
@@ -123,7 +121,7 @@ void main() {
processManager:
processManager
,
processManager:
processManager
,
terminal:
terminal
,
terminal:
terminal
,
stdio:
mockStdio
,
stdio:
mockStdio
,
flutterVersion:
flutterVersion
,
flutterVersion:
f
akeF
lutterVersion
,
logger:
bufferLogger
,
logger:
bufferLogger
,
);
);
...
@@ -144,7 +142,7 @@ void main() {
...
@@ -144,7 +142,7 @@ void main() {
});
});
testUsingContext
(
'Downgrade prompts for user input when terminal is attached - n'
,
()
async
{
testUsingContext
(
'Downgrade prompts for user input when terminal is attached - n'
,
()
async
{
when
(
flutterVersion
.
channel
).
thenReturn
(
'master'
);
final
FakeFlutterVersion
fakeFlutterVersion
=
FakeFlutterVersion
(
channel:
'master'
);
when
(
mockStdio
.
hasTerminal
).
thenReturn
(
true
);
when
(
mockStdio
.
hasTerminal
).
thenReturn
(
true
);
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
.
writeAsStringSync
(
'{"last-active-master-version":"g6b00b5e88"}'
);
.
writeAsStringSync
(
'{"last-active-master-version":"g6b00b5e88"}'
);
...
@@ -153,7 +151,7 @@ void main() {
...
@@ -153,7 +151,7 @@ void main() {
processManager:
processManager
,
processManager:
processManager
,
terminal:
terminal
,
terminal:
terminal
,
stdio:
mockStdio
,
stdio:
mockStdio
,
flutterVersion:
flutterVersion
,
flutterVersion:
f
akeF
lutterVersion
,
logger:
bufferLogger
,
logger:
bufferLogger
,
);
);
...
@@ -174,7 +172,7 @@ void main() {
...
@@ -174,7 +172,7 @@ void main() {
});
});
testUsingContext
(
'Downgrade does not prompt when there is no terminal'
,
()
async
{
testUsingContext
(
'Downgrade does not prompt when there is no terminal'
,
()
async
{
when
(
flutterVersion
.
channel
).
thenReturn
(
'master'
);
final
FakeFlutterVersion
fakeFlutterVersion
=
FakeFlutterVersion
(
channel:
'master'
);
when
(
mockStdio
.
hasTerminal
).
thenReturn
(
false
);
when
(
mockStdio
.
hasTerminal
).
thenReturn
(
false
);
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
.
writeAsStringSync
(
'{"last-active-master-version":"g6b00b5e88"}'
);
.
writeAsStringSync
(
'{"last-active-master-version":"g6b00b5e88"}'
);
...
@@ -186,7 +184,7 @@ void main() {
...
@@ -186,7 +184,7 @@ void main() {
processManager:
processManager
,
processManager:
processManager
,
terminal:
terminal
,
terminal:
terminal
,
stdio:
mockStdio
,
stdio:
mockStdio
,
flutterVersion:
flutterVersion
,
flutterVersion:
f
akeF
lutterVersion
,
logger:
bufferLogger
,
logger:
bufferLogger
,
);
);
...
@@ -201,7 +199,7 @@ void main() {
...
@@ -201,7 +199,7 @@ void main() {
});
});
testUsingContext
(
'Downgrade performs correct git commands'
,
()
async
{
testUsingContext
(
'Downgrade performs correct git commands'
,
()
async
{
when
(
flutterVersion
.
channel
).
thenReturn
(
'master'
);
final
FakeFlutterVersion
fakeFlutterVersion
=
FakeFlutterVersion
(
channel:
'master'
);
when
(
mockStdio
.
hasTerminal
).
thenReturn
(
false
);
when
(
mockStdio
.
hasTerminal
).
thenReturn
(
false
);
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
fileSystem
.
currentDirectory
.
childFile
(
'.flutter_tool_state'
)
.
writeAsStringSync
(
'{"last-active-master-version":"g6b00b5e88"}'
);
.
writeAsStringSync
(
'{"last-active-master-version":"g6b00b5e88"}'
);
...
@@ -230,7 +228,7 @@ void main() {
...
@@ -230,7 +228,7 @@ void main() {
]),
]),
terminal:
terminal
,
terminal:
terminal
,
stdio:
mockStdio
,
stdio:
mockStdio
,
flutterVersion:
flutterVersion
,
flutterVersion:
f
akeF
lutterVersion
,
logger:
bufferLogger
,
logger:
bufferLogger
,
);
);
...
...
packages/flutter_tools/test/commands.shard/permeable/upgrade_test.dart
View file @
8b144544
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/src/mocks.dart
View file @
8b144544
...
@@ -15,7 +15,6 @@ import 'package:flutter_tools/src/build_info.dart';
...
@@ -15,7 +15,6 @@ import 'package:flutter_tools/src/build_info.dart';
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/ios/devices.dart'
;
import
'package:flutter_tools/src/ios/devices.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/version.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:process/process.dart'
;
import
'package:process/process.dart'
;
...
@@ -235,4 +234,3 @@ class MockStdIn extends Mock implements IOSink {
...
@@ -235,4 +234,3 @@ class MockStdIn extends Mock implements IOSink {
}
}
class
MockStream
extends
Mock
implements
Stream
<
List
<
int
>>
{}
class
MockStream
extends
Mock
implements
Stream
<
List
<
int
>>
{}
class
MockFlutterVersion
extends
Mock
implements
FlutterVersion
{}
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