jasonmccreary/expect
Composer 安装命令:
composer require jasonmccreary/expect
包简介
BDD-style assertions for PHP.
README 文档
README
Expect is a BDD-style assertion library for PHP - allowing you to express expectations using a natural, fluent interface.
// equality expect(1)->toEqual('1'); expect(2)->toBe(2); // comparison expect(5)->toBeLessThan(7); expect(5)->toBeLessThanOrEqualTo(5); expect(5)->toBeGreaterThan(4); expect(5)->toBeGreaterThanOrEqualTo(5); // true / false / null expect(true)->toBeTrue(); expect('1')->toBeTruthy(); expect(false)->toBeFalse(); expect('0')->toBeFalsy(); expect(null)->toBeNull(); // strings expect('string')->toContain('in'); expect('string')->toStartWith('str'); expect('string')->toEndWith('ing'); expect('string')->toHaveLength(6); expect('string')->toMatchPattern('/string/'); expect('string')->toMatchFormat('%s'); // arrays expect(['a', 'b', 'c'])->toHaveCount(3); expect(['a', 'b', 'c'])->toContain('a'); expect(['key' => 'value'])->toHaveKey('key'); // types expect(1)->toBeType('int'); expect(new Example())->toBeInstanceOf(Example::class); expect('{"key": "value"}')->toBeJson(); expect('<key>value</key>')->toBeXml(); // files expect('file.txt')->toExist(); // negation expect(1)->not()->toEqual(2); expect(true)->not()->toBeFalse(); expect($value)->not()->toBeNull();
Installation
Install Expect as a development dependency to your project using Composer:
composer require --dev jasonmccreary/expect
Usage
Expect is used by PSpec, but can be used within other PHP testing frameworks or as a stand-alone.
Documentation
Documentation and additional examples will be available in the official release.
License
Expect is open-sourced software licensed under the MIT license.
Thanks
Expect was built atop Verify and heavily inspired by RSpec and Jasmine. I want to recognize and thank these projects.
jasonmccreary/expect 适用场景与选型建议
jasonmccreary/expect 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 57 次下载、GitHub Stars 达 5, 最近一次更新时间为 2016 年 06 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「BDD」 「test」 「matcher」 「assert」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jasonmccreary/expect 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jasonmccreary/expect 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jasonmccreary/expect 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Helper that decorates any SUS with a phpspec lazy object wrapper
Behat Context for testing Symfony Api
Generic engine to match identifiers against simple yet powerful patterns
Provides access to magento2 object manager from behat and allows to change magento config settings temporarly
Testing Suite For Lumen like Laravel does.
AppVerk extension of PHP Matcher, it enables you to match values with patterns
统计信息
- 总下载量: 57
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 4
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-06-30