[google_sign_in, in_app_purchase_android] Add availability to mock models (#5642)
diff --git a/AUTHORS b/AUTHORS
index 41a31ed..31402c7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -67,3 +67,4 @@
Daniel Roek <daniel.roek@gmail.com>
TheOneWithTheBraid <the-one@with-the-braid.cf>
Rulong Chen(陈汝龙) <rulong.crl@alibaba-inc.com>
+Hwanseok Kang <tttkhs96@gmail.com>
diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md
index 86a3b56..ad21ee2 100644
--- a/packages/google_sign_in/google_sign_in/CHANGELOG.md
+++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md
@@ -1,5 +1,6 @@
-## NEXT
+## 5.3.2
+* Enables mocking models by changing overridden operator == parameter type from `dynamic` to `Object`.
* Updates tests to use a mock platform instead of relying on default
method channel implementation internals.
* Removes example workaround to build for arm64 iOS simulators.
diff --git a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart
index 228f34b..3c62e0e 100644
--- a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart
+++ b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart
@@ -129,7 +129,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml
index 2a287b1..6862a55 100644
--- a/packages/google_sign_in/google_sign_in/pubspec.yaml
+++ b/packages/google_sign_in/google_sign_in/pubspec.yaml
@@ -3,7 +3,7 @@
for signing in with a Google account on Android and iOS.
repository: https://github.com/flutter/plugins/tree/main/packages/google_sign_in/google_sign_in
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
-version: 5.3.1
+version: 5.3.2
environment:
diff --git a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart
index 61acfd8..2bc51b6 100644
--- a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart
+++ b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart
@@ -9,9 +9,12 @@
import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
-
import 'google_sign_in_test.mocks.dart';
+/// Verify that [GoogleSignInAccount] can be mocked even though it's unused
+// ignore: must_be_immutable
+class MockGoogleSignInAccount extends Mock implements GoogleSignInAccount {}
+
@GenerateMocks(<Type>[GoogleSignInPlatform])
void main() {
late MockGoogleSignInPlatform mockPlatform;
diff --git a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md
index 18284f2..05c2952 100644
--- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md
+++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.2.2+6
+
+* Enables mocking models by changing overridden operator == parameter type from `dynamic` to `Object`.
+
## 0.2.2+5
* Minor fixes for new analysis options.
diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.dart
index 07f9d8f..1c5c2d1 100644
--- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.dart
+++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/sku_details_wrapper.dart
@@ -135,7 +135,7 @@
final int originalPriceAmountMicros;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (other.runtimeType != runtimeType) {
return false;
}
@@ -203,7 +203,7 @@
final List<SkuDetailsWrapper> skuDetailsList;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (other.runtimeType != runtimeType) {
return false;
}
@@ -248,7 +248,7 @@
final String? debugMessage;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (other.runtimeType != runtimeType) {
return false;
}
diff --git a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml
index 277be29..1099c3a 100644
--- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml
+++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml
@@ -2,7 +2,7 @@
description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs.
repository: https://github.com/flutter/plugins/tree/main/packages/in_app_purchase/in_app_purchase_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
-version: 0.2.2+5
+version: 0.2.2+6
environment:
sdk: ">=2.14.0 <3.0.0"
@@ -28,4 +28,5 @@
flutter_test:
sdk: flutter
json_serializable: ^6.0.0
+ mockito: ^5.1.0
test: ^1.16.0
diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/sku_details_wrapper_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/sku_details_wrapper_test.dart
index ecc399b..2d14368 100644
--- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/sku_details_wrapper_test.dart
+++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/sku_details_wrapper_test.dart
@@ -125,6 +125,60 @@
expect(billingResult.debugMessage, kInvalidBillingResultErrorMessage);
expect(billingResult.responseCode, BillingResponse.error);
});
+
+ test('operator == of SkuDetailsWrapper works fine', () {
+ const SkuDetailsWrapper firstSkuDetailsInstance = SkuDetailsWrapper(
+ description: 'description',
+ freeTrialPeriod: 'freeTrialPeriod',
+ introductoryPrice: 'introductoryPrice',
+ introductoryPriceAmountMicros: 990000,
+ introductoryPriceCycles: 1,
+ introductoryPricePeriod: 'introductoryPricePeriod',
+ price: 'price',
+ priceAmountMicros: 1000,
+ priceCurrencyCode: 'priceCurrencyCode',
+ priceCurrencySymbol: r'$',
+ sku: 'sku',
+ subscriptionPeriod: 'subscriptionPeriod',
+ title: 'title',
+ type: SkuType.inapp,
+ originalPrice: 'originalPrice',
+ originalPriceAmountMicros: 1000,
+ );
+ const SkuDetailsWrapper secondSkuDetailsInstance = SkuDetailsWrapper(
+ description: 'description',
+ freeTrialPeriod: 'freeTrialPeriod',
+ introductoryPrice: 'introductoryPrice',
+ introductoryPriceAmountMicros: 990000,
+ introductoryPriceCycles: 1,
+ introductoryPricePeriod: 'introductoryPricePeriod',
+ price: 'price',
+ priceAmountMicros: 1000,
+ priceCurrencyCode: 'priceCurrencyCode',
+ priceCurrencySymbol: r'$',
+ sku: 'sku',
+ subscriptionPeriod: 'subscriptionPeriod',
+ title: 'title',
+ type: SkuType.inapp,
+ originalPrice: 'originalPrice',
+ originalPriceAmountMicros: 1000,
+ );
+ expect(firstSkuDetailsInstance == secondSkuDetailsInstance, isTrue);
+ });
+
+ test('operator == of BillingResultWrapper works fine', () {
+ const BillingResultWrapper firstBillingResultInstance =
+ BillingResultWrapper(
+ responseCode: BillingResponse.ok,
+ debugMessage: 'debugMessage',
+ );
+ const BillingResultWrapper secondBillingResultInstance =
+ BillingResultWrapper(
+ responseCode: BillingResponse.ok,
+ debugMessage: 'debugMessage',
+ );
+ expect(firstBillingResultInstance == secondBillingResultInstance, isTrue);
+ });
});
}