dizews/yii2-qunit

此包已被废弃,不再维护。未建议替代包。

Yii框架的QUnit扩展

安装: 126

依赖者: 0

建议者: 0

安全: 0

星标: 2

关注者: 1

分支: 1

开放问题: 1

类型:yii2-extension

dev-master 2014-07-07 07:04 UTC

This package is not auto-updated.

Last update: 2017-09-29 18:11:46 UTC


README

QUnit JavaScript 单元测试框架,适用于 Yii2。

安装

通过 composer 安装此扩展是首选方式。

运行以下命令:

php composer.phar require --dev --prefer-dist dizews/yii2-qunit "*"

或者添加以下内容到您的 composer.json 的 require-dev 部分:

"dizews/yii2-qunit": "*"

通用用法

要使用此扩展,只需在您的应用程序配置中添加以下代码:

return [
    //....
    'modules' => [
        'qunit' => [
            'class' => 'dizews\qunit\Module',
            //'runner' => ['template' => '@app/views/js-tests-runner/index'] //your own tests runner
        ],
    ],
];

您可以通过以下 URL 访问 QUnit:

http://localhost/path/to/index.php?r=qunit

或者如果您已启用美观的 URL,您可以使用以下 URL:

http://localhost/path/to/index.php/qunit

测试目录结构

...
tests/
    js/
        unit/
            fixtures    contains fixtures
            example.js  example of test
        test_helper.js  javascript test helper
        test_helper.css css test helper

固定数据

所有由具有名称 fixture- + 文件名的 iddiv 标签装饰的固定数据。