承接 i3bepb/reflection-for-test 相关项目开发

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

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

i3bepb/reflection-for-test

最新稳定版本:1.0.3

Composer 安装命令:

composer require i3bepb/reflection-for-test

包简介

Trait adding access method through reflection for tests

README 文档

README

Latest Stable Version Total Downloads

Trait adding access method through reflection for tests

Install

composer require --dev i3bepb/reflection-for-test

How to use

When need call private method and check result in test, you can use trait AccessToMethod. Example:

  
use I3bepb\ReflectionForTest\AccessToMethod;
use PHPUnit\Framework\TestCase;

class AnyTest extends TestCase
{
    use AccessToMethod;

    /**
     * Any test.
     *
     * @test
     *
     * @throws \ReflectionException
     */
    public function any_test()
    {
        $object = new ClassWithPrivateMethod();

        // In $resultPrivateMethod result after call private method
        $resultPrivateMethod = $this->privateMethodWithParameters($object, 'privateMethod', ['abc', 123]);
        
        // Any test...
    }

Tests through docker

Download image

docker pull php:7.0.33-cli-alpine

Run container with volume into

docker run --rm -it -v $(pwd):/app -w /app php:7.0.33-cli-alpine sh

Into container get composer - https://getcomposer.org/download/

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Now exist file composer.phar and you can download dependencies

php composer.phar install

Run tests

./vendor/bin/phpunit

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固