定制 netrivet/refute-assert 二次开发

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

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

netrivet/refute-assert

最新稳定版本:2.0.0

Composer 安装命令:

composer require netrivet/refute-assert

包简介

Use refuteX terminology instead of assertNotX for PHPUnit assertions, plus some extra assert/refute pairs.

关键字:

README 文档

README

PHPUnit is awesome. But remembering the inversions of the assertions is really difficult. I'm sure there's some sort of method to Sebastian's madness, but I can't figure out what it is. Take these examples:

<?php

$this->assertNotContainsOnly();
$this->assertClassNotHasStaticAttribute();
$this->assertStringEndsNotWith();

Remembering where to put the Not is tough.

##Solution: Refute

RefuteAssert aliases all of the assert*Not* assertion inversions to refuteX. So, now we can type:

<?php

$this->refuteContainsOnly();
$this->refuteClassHasStaticAttribute();
$this->refuteStringEndsWith();

This keeps the API perfectly consistent, reads very fluently, is much easier to remember, and has the added bonus that assert and refute have the same number of characters, so it makes your test methods look cleaner. Props to Buster.js for the idea.

##Installation

Pull the package in through Composer.

{
    "require": {
        "downshiftorg/refute-assert": "0.1.*"
    }
}

Then, just use the RefuteAssert trait in a TestCase class that extends PHPUnit_Framework_TestCase. If you don't already have such a class, create one, otherwise just add the trait to your existing child class. Here's an example:

<?php

namespace Acme\Foo;

class MyTestCase extends \PHPUnit_Framework_Testcase {

	use \DownShift\RefuteAssert\RefuteAssert;

}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固