Skip to content

Commit

Permalink
Remove deprecated setMockMethodCallHandler from tests (close #41)
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-tomlein committed Feb 21, 2024
1 parent 2f79172 commit 8f73cc4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
flutter: ['3.0.0']
flutter: ['3.19.0']
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
Expand All @@ -23,11 +23,11 @@ jobs:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
flutter-version: '3.0.0'
flutter-version: '3.19.0'
channel: 'stable'
- run: flutter pub get
- run: flutter analyze
- run: flutter format -n --set-exit-if-changed .
- run: dart format --set-exit-if-changed .

build-android:
name: Integration tests on Android
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
# -- Integration tests --
- uses: subosito/flutter-action@v1
with:
flutter-version: '3.0.0'
flutter-version: '3.19.0'
channel: 'stable'

- name: Run Flutter Driver tests
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:

- uses: subosito/flutter-action@v1
with:
flutter-version: '3.0.0'
flutter-version: '3.19.0'
channel: 'stable'

- run: "flutter clean"
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
# -- Integration tests --
- uses: subosito/flutter-action@v1
with:
flutter-version: '3.0.0'
flutter-version: '3.19.0'
channel: 'stable'

- run: chromedriver --port=4444 &
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
flutter: ['3.0.0']
flutter: ['3.19.0']
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
Expand Down
6 changes: 4 additions & 2 deletions test/snowplow_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ void main() {
setUp(() {
methodCall = null;
returnValue = null;
channel.setMockMethodCallHandler((MethodCall call) async {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, (MethodCall call) async {
methodCall = call;
return returnValue;
});
});

tearDown(() {
channel.setMockMethodCallHandler(null);
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, (message) => null);
});

test('createsTrackerWithConfiguration', () async {
Expand Down
6 changes: 4 additions & 2 deletions test/tracker_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ void main() {
setUp(() async {
returnValue = null;

channel.setMockMethodCallHandler((MethodCall methodCall) async {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, (MethodCall methodCall) async {
method = methodCall.method;
arguments = methodCall.arguments;
return returnValue;
Expand All @@ -39,7 +40,8 @@ void main() {
});

tearDown(() {
channel.setMockMethodCallHandler(null);
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, null);
});

test('tracks structured event', () async {
Expand Down

0 comments on commit 8f73cc4

Please sign in to comment.