phpunitgoodpractices/traits 问题修复 & 功能扩展

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

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

phpunitgoodpractices/traits

最新稳定版本:v1.9.2

Composer 安装命令:

composer require phpunitgoodpractices/traits

包简介

Highly opinionated PHPUnit good practices enforcer.

README 文档

README

With great shape of PHPUnit itself and Static Code Analysers supporting it, this package is no longer needed.

PHPUnit Good Practices

Highly opinionated PHPUnit good practices enforcer.

Available traits

ExpectationViaCodeOverAnnotationTrait

Expected exception shall be set up via code, not annotations.

ExpectOverSetExceptionTrait

Expectation shall be set directly over via setter.

IdentityOverEqualityTrait

Identity assertion (===) shall be used over equality ones (==).

ProphecyOverMockObjectTrait

Prophecy shall be used over Mock Objects.

ProphesizeOnlyInterfaceTrait

Prophecy shall be created only for (existing) interfaces.

Example usage

<?php namespace FooProject\Tests; use PHPUnit\Framework\TestCase; use PHPUnitGoodPractices\Traits\ExpectationViaCodeOverAnnotationTrait; use PHPUnitGoodPractices\Traits\ExpectOverSetExceptionTrait; use PHPUnitGoodPractices\Traits\IdentityOverEqualityTrait; use PHPUnitGoodPractices\Traits\ProphecyOverMockObjectTrait; use PHPUnitGoodPractices\Traits\ProphesizeOnlyInterfaceTrait; final class FooTest extends TestCase { use ExpectationViaCodeOverAnnotationTrait; use ExpectOverSetExceptionTrait; use IdentityOverEqualityTrait; use ProphecyOverMockObjectTrait; use ProphesizeOnlyInterfaceTrait; public function testBar() { $this->assertEquals(123, 213); // will report non-strict assertion usage } }

统计信息

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

GitHub 信息

  • Stars: 22
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固