定制 jasonmccreary/expect 二次开发

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

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

jasonmccreary/expect

Composer 安装命令:

composer require jasonmccreary/expect

包简介

BDD-style assertions for PHP.

README 文档

README

Build Status Latest Stable Version

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-06-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固