jrmadsen67/laravel-route-coverage-test 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

jrmadsen67/laravel-route-coverage-test

Composer 安装命令:

composer require jrmadsen67/laravel-route-coverage-test

包简介

Route coverage test for Laravel.

README 文档

README

Tests Style

Tests to ensure that all routes are covered by atleast one feature test.

This is a slightly crude but effective way of checking which of your routes lack feature tests. It simply uses middleware to record all routes being hit during the feature tests, checks to ensure that matches the full route amount.

The zRouteCoverageTest has a funny name for a reason - PHPUnit runs tests in alphabetical order. To most easily capture all the test coverage data first, keep it named to run last, and in your Feature directory. Also - the output relies on routes having names to give useful data. Happy Testing!

Index

Installation

Via Composer, you can run a composer require which will grab the latest version of this repo...

composer require --dev jrmadsen67/laravel-route-coverage-test

...and then...

php artisan vendor:publish --provider="jrmadsen67\LaravelRouteCoverageTest\Providers\CoverageServiceProvider"

...to publish the required config and feature test file into your app. The middleware is automatically applied globally by this packages service provider.

Note: See version tagged 1.1 for Laravel <5.5 support.

Installation - This Package Version vs. PHP & Laravel Versions

The following table describes which version of this packagae you will require for the given PHP & Laravel version.

Package Version PHP Version Laravel Version
^2.0 ^7.4 | ^8.0 ^7.0 | ^8.0
^1.0 - -

Usage

Run your tests as normal via phpunit, or the default Laravel test suite:

php artisan test

# OR

vendor/bin/phpunit

Testing

There is a Docker container that is pre-built that contains an Alpine CLI release of PHP + PHPUnit + xdebug. This is setup to test the project and can be setup via the following:

composer build

This should trigger Docker Compose to build the image.

There are tests for all code written, in which can be run via:

# Using PHPUnit, with code coverage reporting, within the Docker container
composer test

# Using PHPUnit, with code coverage reporting, within the Docker container, specifying a direct test
composer test-filtered ItGeneratesSqlFromMigrations

# Using PHPUnit, with code coverage reporting, using local phpunit and xdebug
composer test-local

# Using PHPUnit, with code coverage reporting, using local phpunit and xdebug, specifying a direct test
composer test-local-filtered ItGeneratesSqlFromMigrations

In those tests, there are Feature tests for a production ready implementation of the package. There are also Unit tests for each class written for full coverage.

You can also easily open a shell in the testing container by using the command:

composer shell

Changelog

Any and all project changes for releases should be documented below. Versioning follows the SEMVER standard.

Version 2.0.0

Big project refactor, see the changelog sections for more info.

Added

  • Config support for defining excluded routes and route groups
  • Docker container for a fixed testing environment with code coverage support via XDebug
  • New global tests path helper tests_path() that will generate a fully qualified path to the tests directory
  • Various composer scripts to shortcut common testing and style fixing functionality
  • GitHub actions for automated testing and style fixes as a basic CI pipeline
  • Spatie Ray support for enhanced debugging
  • Testing of this packages functionality
  • Code coverage and getting the coverage to around ~95%
  • PHP-CS-Fixer for making the project style adhere to a fixed set of code standards
  • Binding the package to both PHP and Laravel version requirements for easy compatibility reference

Changed

  • Refactored shared methods between the middleware and test into a new ReportHelper object for testing purposes and centralising of reusable code
  • Refactored the package middleware to reside instead within the package and its namespace, again so it can be tested and also to not pollute the installed application
  • Renamed xCoverageTest to zRouteCoverageTest to better reflect what the test covers
  • Complete refactor of the readme to best reflect the changes in this update

Fixed

  • The middleware now applies itself globally using the latest method of doing so for Laravel versions >5.5
  • Manual version lock in for spatie/macroable to ^1.0 to fix composer getting confused about requirement conflicts

Removed

  • The package middleware is no longer published into the installed application and is instead held within the package and its namespace

Version 1.1

Initial release. Pre-semver implementation.

Added

  • Everything

Changed

  • Everything

Fixed

  • Everything

Removed

  • Everything

jrmadsen67/laravel-route-coverage-test 适用场景与选型建议

jrmadsen67/laravel-route-coverage-test 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32.25k 次下载、GitHub Stars 达 56, 最近一次更新时间为 2018 年 12 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 jrmadsen67/laravel-route-coverage-test 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 56
  • Watchers: 1
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-25