Automattic / Automattic/jetpack
New Unit Test: Register/Unregister hooks
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
We need tests to ensure our `register_activation_hook` and `register_deactivation_hook`s are firing as expected on plugin activation/deactivation.
Not sure the best way to do it, but can we write a test that just uses the two functions and hard-code the jetpack.php path in the first param? Something like
`register_activation_hook( jetpack.php, array( $this, 'set_some_test_option' ) );`
`register_deactivation_hook( jetpack.php, array( $this, 'delete_some_test_option' ) );`
and somewhere in there also use core functions to activate/deactivate?
Otherwise, it should be a straightforward E2E
Related bug: #13058
Contributor guide
Research direction
Start with the register_activation_hook and register_deactivation_hook entry points and the proposed jetpack.php path. Check how WordPress core activation and deactivation functions can invoke those hooks, then determine whether a unit test or E2E test is appropriate. Done means tests demonstrate both hooks fire during plugin activation and deactivation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100