Drop-in Trait to use removed ConsecutiveParams from PhpUnit

1.1.4 2023-12-18 22:50 UTC

This package is auto-updated.

Last update: 2024-05-19 01:12:24 UTC


Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

PHPUnit Consecutive Parameters

After PHPUnit has removed the possibility to use withConsecutive, which was used by thousand of UnitTests, developers need a replacement which is not offered in a neat way at the moment.

Until this problem is solved directly in PHPUnit, this library offers a simple solution to use a replacement of withConsecutive again. The original solution posted here.


$ composer require --dev seec/phpunit-consecutive-params




namespace Your\Namespace\For\Tests;

use SEEC\PhpUnit\Helper\ConsecutiveParams;

final class TestRunnerContextTest extends TestCase
    use ConsecutiveParams;

    public function test_it_can_use_consecutive_replacement(): void
        $mock = $this->createMock(\stdClass::class);
                ['a', 'b'],
                ['c', 'd'],
                ['e', 'f']

Another example for automatic replacement in correctly formatted code:

    ['a', 'b'],
    ['c', 'd'],
    ['e', 'f']


    ['a', 'b'],
    ['c', 'd'],
    ['e', 'f']