定制 sakharovmaksim/annotation-processor 二次开发

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

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

sakharovmaksim/annotation-processor

Composer 安装命令:

composer require sakharovmaksim/annotation-processor

包简介

Utility for parsing constants from the description of the test methods. Created by tutu.ru

README 文档

README

Install

1. Download project from the repository

Navigate to the directory where you want to store the directory with project. For instance, your home directory cd ~.

git clone git@github.com:sakharovmaksim/annotation-processor.git

And when downloading is done, navigate to the project directory cd annotation-processor.

2. Install dependencies

composer install

Usage

1. In your TestCase class

In your TestCase class, in setUp() method, which extends from \PHPUnit\Framework\TestCase create and use function like:

public function setUp()
{
	$this->_processAnnotations();
}

private function _processAnnotations()
{
	$class = get_class($this);
	$methodName = $this->getName(false);
	$annotationProcessor = new AnnotationProcessor($class, $methodName);
	// @domains
	if ($domainsExcept = $annotationProcessor->process(new Annotation\ArrayAnnotation(AnnotationsNames::DOMAINS_EXCEPT)))
	{
		if (Env::isRC() && in_array(Env::RC, $domainsExcept))
		{
			$this->markTestSkipped("Skip the test that is not for RC: {$class}::{$methodName}");
		}
		elseif (Env::isProduction() && in_array(Env::PROD, $domainsExcept))
		{
			$this->markTestSkipped("Skip the test that is not for Production: {$class}::{$methodName}");
		}
		elseif (Env::isStand() && in_array(Env::STAND, $domainsExcept))
		{
			$this->markTestSkipped("Skip the test that is not for stands: {$class}::{$methodName}");
		}
	}
	// @bug
	if ($annotationProcessor->process(new Annotation\BoolAnnotation(AnnotationsNames::BUG)))
	{
		$this->markTestSkipped("Skip the test {$class}::{$methodName}, because it has deactivated due to a @bug!");
	}
	// @todocase
	if ($annotationProcessor->process(new Annotation\BoolAnnotation(AnnotationsNames::TODOCASE)))
	{
		$this->markTestSkipped("Skip the test {$class}::{$methodName}, because it has @todocase, write it!");
	}
}

This function, when starting each test, will analyze the constants from the description and apply the actions described in the function above.

2. Create AnnotationsNames file with annotation constants

Use constants in _processAnnotations()

class AnnotationsNames
{
	const DOMAINS_EXCEPT = '@domainsExcept';
	const BUG = '@bug';
	const TODOCASE = '@todocase';
}

3. Usage in tests annotations

/**
 * @labels Labels::RELEASE
 * @todocase Проверка поиска "Только туда"
 */
public function testSearchOW() {}

4. Run unit-tests for project

sh run_tests.sh

5. Deploy

Travis CI run unit-tests for all Pull Requests. Look '.travis.yml'-file with CI-config

Created by tutu.ru

sakharovmaksim/annotation-processor 适用场景与选型建议

sakharovmaksim/annotation-processor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.13k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 05 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 sakharovmaksim/annotation-processor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sakharovmaksim/annotation-processor 我们能提供哪些服务?
定制开发 / 二次开发

基于 sakharovmaksim/annotation-processor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-16