定制 avinash403/phpunit-testing-kit 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

avinash403/phpunit-testing-kit

Composer 安装命令:

composer require --dev avinash403/phpunit-testing-kit

包简介

Gives all the helper traits and classes that you will ever need to test a PHP application

README 文档

README

Collection of useful traits and classes that can be handy while testing a PHP application.

Installation by Composer

$ composer require avinash403/phpunit-testing-kit

Available Traits

Assertions

Contains some common assertions that is commonly used but PHPunit doesn't provide it.

USAGE

use TestingKit\Assertions;
use PHPUnit\Framework\TestCase;

class ExampleTest extends TestCase
{
	use Assertions;

	public function test_exampleTest()
	{
		$this->assertAlpha('a');
	}
}

Available Assertions

	* assertAlpha
	* assertNotAlpha
	* assertNumber
	* assertNotNumber
	* assertArrayHasKeys
	* assertStringContainsSubstring
	* assertStringNotContainsSubstring

PrivateAccess

Allows testing private and protected method and properties of a class.

USAGE

use TestingKit\PrivateAccess;
use PHPUnit\Framework\TestCase;

class ExampleTest extends TestCase
{
	use PrivateAccess;

	public function test_exampleTest_forGettingPrivateMethod()
	{
		$classObject = new Class();
		
		//getting private method
		$methodResponse = $this->getPrivateMethod($classObject, 'exampleMethod', ['some text']);
		
		$this->assertEquals($methodResponse, 'some text');
	}
}

class ExampleClass
{
	private exampleMethod($someArgument)
	{
		return $someArgument;
	}
}

Available Features

	* getPrivateMethod
	* setPrivateProperty
	* getPrivateProperty

Test

Run test by simply typing composer test from the root directory of this package.

Contribute on github

clone this repository( https://github.com/avinash403/laravel-dynamic-observer.git ), make your changes and raise a pull request to development branch

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: OSL-1.0
  • 更新时间: 2018-05-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固