infotechnohelp/test-view-extend

CakePHP 3 插件

安装: 2

依赖项: 0

建议者: 0

安全: 0

星标: 0

分支: 0

类型:cakephp-plugin

dev-master 2019-02-26 12:24 UTC

This package is not auto-updated.

Last update: 2024-09-19 13:20:50 UTC


README

PLUGIN/composer.json

更改 "name" 值

替换路径中的所有 PLUGIN

NewTitle → AnyPluginName

new-title → any-plugin-name

加载插件

将此行添加到 APP/config/bootstrap.php

Plugin::load('AnyPluginName', ['routes' => true]);

迁移表到 APP

CakePHP 3+ APP 根目录

$ bin/cake migrations migrate --plugin AnyPluginName

API 层

前缀 any-plugin-name/api

为了向 PLUGIN/src/Controller/Api/MyPluginController→getById() 发送请求,使用此路径

any-plugin-name/api/my-plugin/get-by-id

测试

运行测试(插件根目录)

vendor/bin/phpunit

为了在 APP/tests 中使用插件固定值,将以下内容添加到 APP/composer.json

    "autoload-dev": {
        "psr-4": {
            ... ,
            "AnyPluginName\\Test\\": "./vendor/philsweb/cakephp-plugin-skeleton/tests",
        }
    },

composer dump-autoload

Sniff

修复(插件根目录)

./sniff -f

检查冲突(插件根目录)

./sniff

PLUGIN/config/.env

export DB_TEST_HOST = localhost
export DB_TEST_NAME = test
export DB_TEST_USERNAME = root
export DB_TEST_PASSWORD =