• Hey everyone,

    We recently had an unexpected bug (although fatal, it’s not breaking any website thankfully, but fatal nevertheless) in a function that’s hooked to the upgrader_process_complete action. By our logic, it’s not possible to test this function because it’s hooked to an action that only fires when the plugin is updated (so we have to push the release) but I was wondering if there was a simulated way to test this. Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    A way to test the callback function as it’s being developed? Call it directly from template code or something similar. You need to artificially create the object and data array passed to the function. You could have the function save this data somewhere during an actual update, then reuse the same data during subsequent testing.

    Thread Starter Optimocha

    (@optimocha)

    Thanks for the response, @bcworkz!

    Weirdly, that won’t work for us – turns out this exact hook runs before all the files are replaced with files from the new version or something like that. Our users (Speed Booster Pack) saw fatal errors (“call to undefined function”) during their plugin updates because a new function that we introduced with the new version.

    Logically, the hook should be run after all of the plugin files are replaced with their new versions, so it shouldn’t throw the fatal error… but it did, which confused us.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to test with upgrader_process_complete?’ is closed to new replies.