承接 wikimedia/testing-access-wrapper 相关项目开发

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

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

wikimedia/testing-access-wrapper

最新稳定版本:4.0.0

Composer 安装命令:

composer require wikimedia/testing-access-wrapper

包简介

A simple helper class to access non-public elements of a class when testing.

README 文档

README

Latest Stable Version License

Wikimedia Testing Access Wrapper

Testing Access Wrapper is a simple helper for writing unit tests which provides convenient shortcuts for using reflection to access non-public properties/methods.

The code was originally part of MediaWiki. See composer.json for a list of authors.

Usage

use Wikimedia\TestingAccessWrapper;

class NonPublic {
	protected $prop;
	protected const CONSTANT = 4;
	protected function func() {}
	protected static function staticFunc() {}
}

class NonPublicCtor {
	protected function __construct() {}
}

$object = new NonPublic();
// or:
// $object = TestingAccessWrapper::construct( NonPublicCtor::class );

$wrapper = TestingAccessWrapper::newFromObject( $object );
$classWrapper = TestingAccessWrapper::newFromClass( NonPublic::class );

$wrapper->prop = 'foo';
$wrapper->func();
$classWrapper->staticFunc();

$value = TestingAccessWrapper::constant( NonPublic::class, 'CONSTANT' );

Running tests

composer install
composer test

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2017-04-19