承接 sophie-spec/ensure 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

sophie-spec/ensure

Composer 安装命令:

composer require sophie-spec/ensure

包简介

Ensure that both arguments are equal

README 文档

README

Ensure is born with the thought that an ideal unit test should be a strict equality between the output of a function and its expected result. Then, Ensure is that base tool for anything to test.

Install

composer require --dev sophie-spec/ensure

Requires PHP >= 7.4.

Use

use function Sophie\Ensure\ensure;

$add = function ($a, $b) {
    return $a + $b;
};

ensure($add(1, 2), 3);

If the assertion fails, a Sophie\Ensure\FailedAssertionException error is thrown with a detailed message:

ensure($add(1, 2), 10);
/*
    Both values are not equal.

    Provided value:
        3

    Expected value:
        10
*/

More complex values are also well printed:

ensure(
    [
        'strawberry',
        'orange',
        'lime',
    ],
    [
        'orange',
        'lime',
        'strawberry',
    ],
);

/*
    Both values are not equal.

    Provided value:
        array:3 [
            0 => (10) "strawberry"
            1 => (6) "orange"
            2 => (4) "lime"
        ]

    Expected value:
        array:3 [
            0 => (6) "orange"
            1 => (4) "lime"
            2 => (10) "strawberry"
        ]
*/

License

MIT.

统计信息

  • 总下载量: 28
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固