wdda/laravel-finder-tests

此包使用反射来查找测试

v1.0.1 2018-10-23 11:36 UTC

This package is not auto-updated.

Last update: 2024-09-29 03:57:59 UTC


README

Software License Build Status

Laravel Finder 单元测试。

注意

类测试的名称必须与类名称完全匹配

//Class
ClassName.php

//Test class
ClassNameTest.php

测试方法的名称和类方法的名称必须匹配

//In class
public function methodName() 
{
    ...
}
//In test class
public function testMethodName() 
{
    ...
}

安装

安装包

$ composer require wdda/laravel-finder-tests --dev

打开你的config/app.php并在提供者数组中添加以下内容

WDDA\LaravelFinderTests\FinderTestsProvider::class,

运行以下命令以发布包配置文件config/finder-tests.php

php artisan vendor:publish --tag=finder-tests

用法

php artisan finder-tests

或仅用于选项未找到

php artisan finder-tests --limit=1

例如config/finder-tests.php的所有设置

return  [
    'directory' => [
        [
            'rootPath' => app_path(),
            'classes' => [ //required
                'dir' => 'Modules/Models', //required
                'methodsExclude' => [
                    '__construct'
                ],
                'classesExclude' => [
                    'App\Modules\Models\Wiki'
                ]
            ],
            'tests' => [ //required
                'dir' => 'Modules/Tests/Unit', //required
                'methodsExclude' => [
                    'test'
                ],
                'classesExclude' => [
                    'App\Modules\Tests\Wiki'
                ]
            ]
        ],
        [
            //Other directory...
        ]
    ]
];

测试

$ phpunit

安全

如果您发现任何与安全相关的问题,请通过电子邮件dima@wdda.pro联系,而不是使用问题跟踪器。

鸣谢

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。