定制 michaeldoehler/phpunit-generator 二次开发

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

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

michaeldoehler/phpunit-generator

最新稳定版本:0.9.2

Composer 安装命令:

composer require michaeldoehler/phpunit-generator

包简介

Php Unit Generator

README 文档

README

Installation

Checkout repository & run composer install to install dependencies

Configuration

Create a config.php like this:

<?php

//instantiate configuration
$configuration = \PhpUnitTestGenerator\Configuration\Configuration::getInstance();

//overwrite base class, per default \PHPUnit_Framework_TestCase is used
//$configuration->setBaseClass("");

//set source directory of classes
$configuration->setSourceDirectory(dirname(__FILE__) . '/example/src');

//set target directory of classes
$configuration->setTargetDirectory(dirname(__FILE__) . '/example/test');

//configure namespace mappings, e.g. if your tests exists in different namespace
$configuration->setNamespaceMappings(array(
    "Example" => "Example\\Tests",
));
?>

Cli commands:

php phpunit-generator.php generate
php phpunit-generator.php test

Components

Base

General configuration like base class, source and target directory.

Indexer

Creates a generatable index from e.g. Filesystem and provides an iterator with an instance of Testable class of every file!

Generator

Chain of generators, which can be used to generate a test class or test method.

Their are 2 strategies to generate, first class based, second method based.

The Generator provider provides the possibility to generate a whole class or just only a test method:

  • PhpUnitTestGenerator\Generator\Provider\Definition\ObjectInterface

  • PhpUnitTestGenerator\Generator\Provider\Definition\MethodInterface

Architecture

The indexer builds an index of testable php classes. The indexer provides this as an indexed resultset.

The testable builder iterates over every found class and creates a testable object from the given class.

The generator generates each result of the given testable resultset and tries to generates a test class based on the given object and/or method strategies.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-07-07