ngyuki/phpunit-functions

PHPUnit Functions.php 自动加载器

v1.0 2017-07-27 05:18 UTC

This package is auto-updated.

Last update: 2024-09-08 18:14:13 UTC


README

Build Status

PHPUnit 包含用于断言简化的 Functions.php 文件。

// normally
$this->assertThat($actual, $this->equalTo($expect));

// shorthand
assertThat($actual, equalTo($expect));

这非常有用,但您需要显式加载 Functions.php

// I need to know location of Functions.php
require_once __DIR__ . '/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php';

当使用 phar 运行 PHPUnit 时,这会更困难。

// I need to know phar filename
require_once 'phar://phpunit-6.2.phar/phpunit/Framework/Assert/Functions.php';

如果您将 ngyuki/phpunit-functions 添加到项目中,Functions.php 将自动加载。

composer require --dev ngyuki/phpunit-functions

享受测试之旅!