定制 seec/phpunit-consecutive-params 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

seec/phpunit-consecutive-params

最新稳定版本:1.2

Composer 安装命令:

composer require seec/phpunit-consecutive-params

包简介

Drop-in Trait to use removed ConsecutiveParams from PhpUnit

README 文档

README

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.

Installation

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

Usage

<?php

declare(strict_types=1);

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);
        $mock->expects($this->exactly(3))
            ->method('foo')
            ->with(...$this->withConsecutive(
                ['a', 'b'],
                ['c', 'd'],
                ['e', 'f']
            ));
    }

Another example for automatic replacement in correctly formatted code:

->withConsecutive(
    ['a', 'b'],
    ['c', 'd'],
    ['e', 'f']
)

becomes

->with(...$this->withConsecutive(
    ['a', 'b'],
    ['c', 'd'],
    ['e', 'f']
))

统计信息

  • 总下载量: 578.48k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 18
  • 点击次数: 2
  • 依赖项目数: 6
  • 推荐数: 0

GitHub 信息

  • Stars: 18
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2023-07-04