Skip to content

Support for partially ordered parameter sets in mock object expectations#6606

Closed
laloona wants to merge 9 commits into
sebastianbergmann:mainfrom
laloona:parameter-sets-with-partial-order
Closed

Support for partially ordered parameter sets in mock object expectations#6606
laloona wants to merge 9 commits into
sebastianbergmann:mainfrom
laloona:parameter-sets-with-partial-order

Conversation

@laloona
Copy link
Copy Markdown
Contributor

@laloona laloona commented May 8, 2026

Follow up from PR 6604.

I changed to API to that:

$mock->expects($this->exactly(4))
    ->method('dispatch')
    ->withParameterSetsInPartialOrder(
        ['pinned' => $a],
        [$b],
        [$c],
        ['pinned' => $d],
    );

So Assert::fixed is removed.
Additional I removed the duplication of the exception.
The index in IndexedParameters is moved to the constructor, so it can't be null now.

I hope the naming for the tests is now more consistent.

I noticed that the @param list<mixed> $parameters is correct. When we enter the construct $parameters are not clearly defined as they represent argument sets.

laloona added 7 commits May 3, 2026 11:23
…m/laloona/phpunit into parameter-sets-with-partial-order

* 'parameter-sets-with-partial-order' of https://github.com/laloona/phpunit: (23 commits)
  Closes sebastianbergmann#6605
  Fix errors reported by PHPStan
  Activate more rules
  Update tools
  Report errors and failures as soon as possible
  Narrow types for provided data
  Increase PHPStan Rule Level to 10
  Refactor
  Increase PHPStan Rule Level to 9
  Refactor
  Increase PHPStan Rule Level to 8
  Refactor
  Increase PHPStan Rule Level to 7
  Refactor
  Update dependencies
  Refactor
  Return early
  Improve type annotations
  Assert that we have a current element
  Refactor
  ...

# Conflicts:
#	src/Framework/MockObject/Runtime/Rule/UnorderedParameterSets.php
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

API Surface Changes

If any of the additions below are not intended as public API, mark them with @internal in the docblock.

New API Surface

Methods

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.84%. Comparing base (b780c68) to head (ff93880).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6606      +/-   ##
============================================
+ Coverage     96.82%   96.84%   +0.01%     
- Complexity     8446     8475      +29     
============================================
  Files           859      861       +2     
  Lines         26055    26125      +70     
============================================
+ Hits          25228    25300      +72     
+ Misses          827      825       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sebastianbergmann sebastianbergmann added type/enhancement A new idea that should be implemented feature/test-doubles Test Stubs and Mock Objects labels May 10, 2026
@sebastianbergmann sebastianbergmann added this to the PHPUnit 13.2 milestone May 10, 2026
@sebastianbergmann sebastianbergmann self-assigned this May 10, 2026
@sebastianbergmann sebastianbergmann changed the title Add support for partially ordered parameter sets Support for partially ordered parameter sets in mock object expectations May 11, 2026
@sebastianbergmann
Copy link
Copy Markdown
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/test-doubles Test Stubs and Mock Objects type/enhancement A new idea that should be implemented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants