Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mocking callNextMethod #2019

Open
tschoonj opened this issue Nov 7, 2024 · 0 comments
Open

Mocking callNextMethod #2019

tschoonj opened this issue Nov 7, 2024 · 0 comments

Comments

@tschoonj
Copy link

tschoonj commented Nov 7, 2024

Hi all,

I am trying to test a new class method, that overrides its parent class method (imported from another package), while simultaneously also calling it. Something like:

setMethod("my_method", "MyClass",
  function(object, arg1 = "", arg2 = "", ...) {
    # do something with arg1 and arg2, producing arg3
    
    arg3 <- process_args(arg1, arg2)
    
    callNextMethod(object, arg = arg3)
})

Now to test this, I would need to mock out the parent my_method, as it tries to establish a DB connection. Any thoughts on how I need to do this?

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant