Skip to content

Integration tests aren't isolated #36

Open
@jkudish

Description

@jkudish

Describe your bug

When running consecutive integration tests, much of the WordPress lifecycle seem to persist between the tests. I would expect each request to run independently.

Steps to Reproduce

Here's two example tests that demonstrate the issue:

test('action demo 1', function(){
	add_action('wp', function(){
		fputs(STDOUT, "wp action fired");
	});

	wp();
});

test('action demo 2', function(){
	// this will still have the action from the previous test
	// and emit the dump
	wp();
});

Expected behavior

The action was defined in the first test, and I would expect it to only fire in that test.

Screenshots, screen recording, code snippet

No response

Environment info

PHP 8.1
WordPress 6.4.2

Please confirm that you have searched existing issues in this repo.

Yes

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions