@@ -28,7 +28,7 @@ local_mocked_s3_method <- function(
2828 check_string(signature )
2929 check_function(definition )
3030
31- old <- getS3method(generic , signature , optional = TRUE )
31+ old <- utils :: getS3method(generic , signature , optional = TRUE )
3232 if (is.null(old )) {
3333 cli :: cli_abort(
3434 " Can't find existing S3 method {.code {generic}.{signature}()}."
@@ -50,15 +50,18 @@ local_mocked_s4_method <- function(
5050 check_character(signature )
5151 check_function(definition )
5252
53- old <- getMethod(generic , signature , optional = TRUE )
53+ old <- methods :: getMethod(generic , signature , optional = TRUE )
5454 if (is.null(old )) {
5555 name <- paste0(generic , " (" , paste0(signature , collapse = " ," ), " )" )
5656 cli :: cli_abort(
5757 " Can't find existing S4 method {.code {name}}."
5858 )
5959 }
60- setMethod(generic , signature , definition , where = topenv(frame ))
61- withr :: defer(setMethod(generic , signature , old , where = topenv(frame )), frame )
60+ methods :: setMethod(generic , signature , definition , where = topenv(frame ))
61+ withr :: defer(
62+ methods :: setMethod(generic , signature , old , where = topenv(frame )),
63+ frame
64+ )
6265}
6366
6467
@@ -123,6 +126,9 @@ TestMockClass <- R6::R6Class(
123126 )
124127)
125128
129+ # Silence R CMD check NOTE: I think it's because TestMockPerson is a claas
130+ # constructor
131+ # ' @importFrom methods new
126132TestMockPerson <- methods :: setClass(
127133 " TestMockPerson" ,
128134 slots = c(name = " character" , age = " numeric" )
0 commit comments