maks3w/phpunit-methods-trait 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

maks3w/phpunit-methods-trait

最新稳定版本:v9.5.0

Composer 安装命令:

composer require maks3w/phpunit-methods-trait

包简介

Provide PHPUnit method signatures as traits for IDE autocomplete

README 文档

README

Provide a PHP Trait with methods present in PHPUnit Test Framework and expected to be implemented by TestCase.

This is useful when traits are used for test reuse, and it's necessary to access to PHPUnit\Framework\TestCase methods from the trait.

Installing via Composer

You can use Composer .

composer require maks3w/phpunit-methods-trait

Usage

Example of use in a trait

use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase;

trait FooTrait {
  use \Maks3w\PhpUnitMethodsTrait\Framework\TestCaseTrait;

  public function testFoo() {
    $mockFoo = $this->getMock('Foo');
    $mockFoo->expects(TestCase::any())
      ->method('getFoo')
      ->willReturn(true)
    ;

    Assert::assertTrue($mockFoo->getFoo());
  }
}

FAQ

Q: Assertion methods are not recognized. Why?
A: Assertion methods like `assertTrue` are static methods present in `PHPUnit\Framework\Assert` just access them using static method call `PHPUnit\Framework\Assert::assertTrue(...)`

License

Code licensed under BSD 2 clauses terms & conditions.

See LICENSE.txt for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2015-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固