swisnl / game-of-tests-laravel
Laravel 游戏测试包。
Requires
- php: >=5.5.9
- gitonomy/gitlib: ^1.0
- knplabs/github-api: ^2.0
- laravel/framework: 5.5.*|5.6.*|5.7.*
- madewithlove/illuminate-psr-cache-bridge: ^1.0
- php-http/client-implementation: ^1.0
- swisnl/game-of-tests: ^1.0
README
此包旨在使在 Laravel 中快速实现游戏测试成为可能。它使用包 swisnl/game-of-tests 并提供一套命令和基本模板,以便您创建自己的游戏测试。
此包作为在 Git 存储库中搜索和查找 PHP 测试的一种方式。我受到了我遇到的 Spotify 测试游戏 的启发。
我想为自己的 PHP 实现创建自己的实现是为了帮助使公司的测试游戏化并鼓励团队进行一般测试。
它是如何工作的?
游戏测试通过扫描 Git 存储库和扫描已知测试文件来工作。它使用 Git blame 来将测试分配给开发者。您可以通过多个 artisan 命令来更新 Github、裸目录或单个存储库。
目前它支持 PhpUnit、Codeception 和 Behat,用于 PHP,以及 Ava、Jasmine、Jest、Mocha、Tape 和 QUnit,用于 JavaScript,True 用于 SCSS。您可以自由地为 swisnl/game-of-tests 贡献新的解析器。
演示
我制作了一个演示,使用此包展示了 Laravel GitHub 组织的游戏测试,可以在 http://gameoftests.swis.nl 上找到。有关在本地安装演示的信息,请参阅 swisnl/game-of-tests-laravel-demo。
作者
由 Björn Brala (@bbrala) 创建。
安装
- 需要此存储库
composer require swisnl/game-of-tests-laravel
- 将服务提供者添加到
app.php
... \Swis\GotLaravel\Providers\GameOfTestsProvider::class, ...
- 发布并运行迁移
php artisan vendor:publish --tag="migrations"
php artisan migrate
- (可选) 发布配置和视图
php artisan vendor:publish --tag="config" php artisan vendor:publish --tag="views"
这发布了配置。有关可用选项,请参阅 配置。
可用的路由
路由基于 route-prefix 的配置。默认值为 got
。
URL | 描述 |
---|---|
/got |
所有时间的排名 |
/got/score-for-month |
当前月份的排名。您可以添加: ?monthsBack=[months] 以返回任意月份。例如,要获取上个月的测试: app.url/got/score-for-month?monthsBack=1 。 |
/got/score-for-months-back |
过去 [months] 个月的排名(默认 1 个月)。您可以添加: ?monthsBack=[months] 以返回任意月份。例如,要获取过去 3 个月的测试: app.url/got/score-for-month?monthsBack=3 。 |
/got/{user} |
用户{user} 的解析测试列表。您可以通过添加?fromMonthsBack=[months] 来返回任意月份的数据。例如,获取过去3个月的测试数据:app.url/got/bjorn-brala?fromMonthsBack=3 ,或者您可以通过添加?monthsBack=[months] 来显示[months]个月前的结果。例如,获取上个月的测试数据:app.url/got/bjorn-brala?monthsBack=1 。 |
命令
您有几种命令可用以更新您的数据。
got:inspect-directory
检查裸仓库的目录。
Usage:
got:inspect-directory [options] [--] <directory>
Arguments:
directory
Options:
--skippast[=SKIPPAST] Skip all before (and including) this
--modified[=MODIFIED] Repository modified since (uses strtotime)
--only[=ONLY] Skip every directory except this one
--dry-run Only inspect, do not insert into the database
got:inspect-github
检查GitHub组织。
Usage:
got:inspect-github [options] [--] <organisation>
Arguments:
organisation
Options:
--modified[=MODIFIED] Repository modified since (uses strtotime)
--dry-run Only inspect, do not insert into the database
got:inspect
检查Git URL。
Usage:
got:inspect [options] [--] <repositoryUrl>
Arguments:
repositoryUrl
Options:
--dry-run Only inspect, do not insert into the database
got:normalize-names
根据配置设置规范化作者名称。
Usage:
got:normalize-names
配置
normalize-names
normalize-names
: 数组
将数组中的名称规范化为单个结果。有时候人们在git名称上做得不好。这将规范化到数组键的委员会名称。
示例
'Björn Brala' => ['bjorn', 'bbrala']
route-prefix
route-prefix
: 字符串
游戏测试路由的前缀。
示例
'route-prefix' => 'got'
excluded-remotes
excluded-remotes
: 数组
哪些远程不应该包含在统计中。这是一个数据库LIKE参数。
示例
'excluded-remotes' => [ 'git@bitbucket.org:swisnl/test-%', ]
excluded-filenames
excluded-filenames
: 数组
哪些文件名不应该包含在统计中。这是一个数据库LIKE参数。
示例
'excluded-filenames' => [ 'tests/ExampleTest.php', 'vendor/%', 'tests/_%', ]
excluded-authors
excluded-authors
: 数组
哪些作者不应该包含在统计中。这是一个数据库LIKE参数。
缓存
cache
: 布尔值 (默认 true
)
启用GitHub请求的缓存,以避免速率限制问题。
示例
'excluded-authors' => [ 'Automated Commiter', 'System' ]