Skip to content

Add test helpers for temporarily adding filters/actions #2153

@acobster

Description

@acobster

Test code that involve adding filters or actions gets noisy because you have to manually remove them at the end of each test, or else the hook spills over into other tests. This also makes it error prone because it's easy to forget to remove the hook.

Add helper methods to Timber_UnitTestCase for temporarily adding filters or actions. These methods should store a reference to the params they were passed. In tearDown(), loop through all the stored references of added filters/actions and remove them using the same params.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions