承接 fhteam/laravel-phpunit 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

fhteam/laravel-phpunit

最新稳定版本:v1.1

Composer 安装命令:

composer require fhteam/laravel-phpunit

包简介

A bunch of Laravel PHPUnit helpers

README 文档

README

Metrics _
Version PHP version
Compatibility Laravel compatibility
Quality Code Climate

This small library contains some helpers for phpUnit.

Base features

TestBase class contains the following features:

  • Setup application type you need to use when testing via $appContract property
  • Setup bootstrap file path you need to use when testing via $bootstrapPath property
  • Ability to use self-configuring traits

Self-configuring traits

Base test class allows you to use automatically configuring traits. It works in the following way:

When test setUp method is called, traits are initialized first. If a trait has any special methods, they are called at the appropriate time. Suppose your test uses trait named HiddenMembersTestTrait. Then the following trait methods will be called on the test class instance:

  • beforeAppHiddenMembersTestTrait() - before Laravel application is created
  • afterAppHiddenMembersTestTrait(Application $app) - right after Laravel application is created, but before leaving phpUnit setUp() method

Testing private and protected members of your classes

WARNING: Testing an object's protected or private properties / methods is generally a bad idea. Use with caution.

If you need to test private or protected test members of your class, you can use HiddenMembersTestTrait in your test classes. It adds the following methods:

  • assertMembersEqual. This method accepts an object and an associative array of object's expected property values and tests if all of the given expected property values equal to those of the object
  • assertMembersSame. This is variant of the above, which tests for sameness instead of equality
  • getObjectProperties. Just returns an array of object's requested properties with their values (disregarding visibility)
  • getMethodCallResult. Returns a result of the method call (disregarding visibility)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2015-03-28