- Notifications
You must be signed in to change notification settings - Fork72
PermalinkChoose a base ref {{ refName }}default Choose a head ref {{ refName }}default
Comparing changes
Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also orlearn more about diff comparisons.
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also.Learn more about diff comparisons here.
base repository:10up/wp_mock
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
Uh oh!
There was an error while loading.Please reload this page.
base:1.1.0
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}defaultLoading
...
head repository:10up/wp_mock
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
Uh oh!
There was an error while loading.Please reload this page.
compare:trunk
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}defaultLoading
- 5commits
- 4files changed
- 4contributors
Commits on Mar 17, 2025
Fix: Multiple
onFiltercall issues related to thewithAnyArgsmet……hod (#259)# Summary <!-- Required -->This PR implements a fix for an issue I discovered when using multiple`onFilter` calls with the `withAnyArgs` method.<img width="807" alt="Screenshot 2025-03-12 at 18 47 52"src="https://github.com/user-attachments/assets/3c1bb38a-830a-4a4a-907c-a61b7f0d8e11"/>###Closes:#258 ## Details <!-- Optional -->While writing some unit test cases using the `withAnyArgs` method, Icame across issues for multiple `onFilter` calls introduced into thetests. At the moment, if a single `onFilter` call is used alongside`withAnyArgs`, it works correctly, but for multiple cases, it doesn'tcorrectly pass the tests. The expected behaviour should be that thisworks for both single and multiple use cases using the `withAnyArgs`.This PR fixes this issue correctly.<img width="587" alt="Screenshot 2025-03-12 at 19 42 19"src="https://github.com/user-attachments/assets/46cfd651-62a7-455b-9b58-257d38a78b84"/>---Run tests:```phpvendor/bin/phpunit ./tests/Unit/WP_MockTest.php ```## Contributor checklist <!-- Required -->- [x] I agree to follow this project's [**Code ofConduct**](https://github.com/10up/.github/blob/trunk/CODE_OF_CONDUCT.md).- [x] I have updated the documentation accordingly - [x] I have added tests to cover changes introduced by this pullrequest- [x] All new and existing tests pass## Testing <!-- Required -->```phppublic function testMultipleOnFilterPassesWithAnyArgs(): void{ WP_Mock::bootstrap(); /** @phpstan-ignore-next-line */ WP_Mock::onFilter('testFilter1') ->withAnyArgs() ->reply('Filtered value 1'); /** @phpstan-ignore-next-line */ WP_Mock::onFilter('testFilter2') ->withAnyArgs() ->reply('Filtered value 2'); /** @phpstan-ignore-next-line */ WP_Mock::onFilter('testFilter3') ->withAnyArgs() ->reply('Filtered value 3'); $filtered_value1 = apply_filters('testFilter1', 'Original value 1'); $filtered_value2 = apply_filters('testFilter2', 'Original value 2'); $filtered_value3 = apply_filters('testFilter3', 'Original value 3'); $this->assertSame('Filtered value 1', $filtered_value1); $this->assertSame('Filtered value 2', $filtered_value2); $this->assertSame('Filtered value 3', $filtered_value3); Mockery::close();}```Run test, it should pass successfully multiple times using the`withAnyArgs` method:```bashcomposer run test```<!-- List any configuration requirements for testing. -->### Reviewer checklist <!-- Required --><!-- The following checklist is for the reviewer: add any steps that maybe relevant while reviewing this pull request -->- [x] Code changes review- [ ] Documentation changes review- [x] Unit tests pass- [x] Static analysis passes---------Co-authored-by: Ashley Gibson <99189195+agibson-godaddy@users.noreply.github.com>
Commits on Dec 2, 2025
Update CHANGELOG for version 1.1.1
Updated changelog for version 1.1.1 with fixes and new features.
Loading
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:git diff 1.1.0...trunk
Uh oh!
There was an error while loading.Please reload this page.