You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2026/05/16 14:04:28 UTC

(cordova-ios) 01/01: fix(actions): fix CDVURLSchemeHandlerTest warnings

This is an automated email from the ASF dual-hosted git repository.

GitToTheHub pushed a commit to branch pr-fix-actions-CDVURLSchemeHandlerTest
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git

commit 91c28b9b55907392c01e9993ec7a21a4f2332ab8
Author: Manuel Beck <ma...@outlook.de>
AuthorDate: Sat May 16 16:04:15 2026 +0200

    fix(actions): fix CDVURLSchemeHandlerTest warnings
    
    - There were a property attribute mismatch: `copy` must bes used instead of `strong` for `request` property
    - Nonnull nil argument warnings fixed: Added a real `WKWebView` test instance in `setUp` and cleared it in `tearDown`
---
 tests/CordovaLibTests/CDVURLSchemeHandlerTest.m | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/CordovaLibTests/CDVURLSchemeHandlerTest.m b/tests/CordovaLibTests/CDVURLSchemeHandlerTest.m
index b02eedc4..bbd0f0d9 100644
--- a/tests/CordovaLibTests/CDVURLSchemeHandlerTest.m
+++ b/tests/CordovaLibTests/CDVURLSchemeHandlerTest.m
@@ -88,7 +88,7 @@
 
 @interface CDVTestURLSchemeTask : NSObject <WKURLSchemeTask>
 
-@property (nonatomic, strong) NSURLRequest* request;
+@property (nonatomic, copy) NSURLRequest* request;
 @property (nonatomic, strong) NSMutableArray<NSData *>* receivedData;
 @property (nonatomic, strong, nullable) NSURLResponse* response;
 @property (nonatomic, strong, nullable) NSError* error;
@@ -140,6 +140,7 @@
 
 @property AppDelegate* appDelegate;
 @property (nonatomic, strong) CDVViewController* viewController;
+@property (nonatomic, strong) WKWebView* testWebView;
 
 @end
 
@@ -152,10 +153,12 @@
     self.appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     [self.appDelegate createViewController];
     self.viewController = self.appDelegate.testViewController;
+    self.testWebView = [[WKWebView alloc] initWithFrame:CGRectZero];
 }
 
 - (void)tearDown
 {
+    self.testWebView = nil;
     [self.appDelegate destroyViewController];
     [super tearDown];
 }
@@ -186,7 +189,7 @@
     CDVURLSchemeHandler *handler = [[CDVURLSchemeHandler alloc] initWithViewController:self.viewController];
     CDVTestURLSchemeTask *task = [[CDVTestURLSchemeTask alloc] initWithURL:[NSURL URLWithString:@"app://localhost/index.html"]];
 
-    [handler webView:nil startURLSchemeTask:task];
+    [handler webView:self.testWebView startURLSchemeTask:task];
 
     XCTAssertEqual(task.responseCount, 1u);
     XCTAssertNotNil(task.response);
@@ -203,8 +206,8 @@
     CDVURLSchemeHandler *handler = [[CDVURLSchemeHandler alloc] initWithViewController:self.viewController];
     CDVTestURLSchemeTask *task = [[CDVTestURLSchemeTask alloc] initWithURL:[NSURL URLWithString:@"app://localhost/index.html"]];
 
-    [handler webView:nil startURLSchemeTask:task];
-    [handler webView:nil stopURLSchemeTask:task];
+    [handler webView:self.testWebView startURLSchemeTask:task];
+    [handler webView:self.testWebView stopURLSchemeTask:task];
 
     XCTAssertEqual(task.responseCount, 1u);
     XCTAssertEqual(task.finishedCount, 0u);
@@ -231,7 +234,7 @@
     CDVURLSchemeHandler *handler = [[CDVURLSchemeHandler alloc] initWithViewController:self.viewController];
     CDVTestURLSchemeTask *task = [[CDVTestURLSchemeTask alloc] initWithURL:[NSURL URLWithString:@"app://localhost/does-not-exist.html"]];
 
-    [handler webView:nil startURLSchemeTask:task];
+    [handler webView:self.testWebView startURLSchemeTask:task];
 
     XCTAssertEqual(task.responseCount, 0u);
     XCTAssertEqual(task.failedCount, 1u);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org