Skip to content

Commit

Permalink
test: Fix deprecated MethodChannel.setMockMethodCallHandler() to Test…
Browse files Browse the repository at this point in the history
…DefaultBinaryMessenger.setMockMethodCallHandler().

This replacement is mentioned by flutter.dev. See https://docs.flutter.dev/release/breaking-changes/mock-platform-channels#description-of-change.
  • Loading branch information
ryojiro committed May 15, 2023
1 parent ee15103 commit 2680641
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/flutter_callkit_incoming_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
const MethodChannel channel = MethodChannel('flutter_callkit_incoming');

TestWidgetsFlutterBinding.ensureInitialized();

const MethodChannel channel = MethodChannel('flutter_callkit_incoming');
final messenger =
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger;

setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
return '42';
});
messenger.setMockMethodCallHandler(channel, (methodCall) async => '42');
});

tearDown(() {
channel.setMockMethodCallHandler(null);
messenger.setMockMethodCallHandler(channel, null);
});
}

0 comments on commit 2680641

Please sign in to comment.