leadz/sylius-cmi-plugin

Sylius 插件,将 CMI 作为支付方式集成到 sylius 商店。

安装: 238

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 3

分支: 0

开放问题: 1

类型:sylius-plugin


README

插件骨架

用于开始 Sylius 插件的骨架。

文档

有关 Sylius 插件开发的全面指南,请参阅 Sylius 文档。在那里,您将找到插件开发指南,其中包含大量示例。

快速安装

传统方式

  1. 运行 composer create-project sylius/plugin-skeleton ProjectName

  2. 从插件骨架根目录运行以下命令:

    $ (cd tests/Application && yarn install)
    $ (cd tests/Application && yarn build)
    $ (cd tests/Application && APP_ENV=test bin/console assets:install public)
    
    $ (cd tests/Application && APP_ENV=test bin/console doctrine:database:create)
    $ (cd tests/Application && APP_ENV=test bin/console doctrine:schema:create)

为了能够设置插件数据库,请记住在 tests/Application/.envtests/Application/.env.test 中配置您的数据库凭据。

Docker

  1. 执行 docker compose up -d

  2. 初始化插件 docker compose exec app make init

  3. 在浏览器中打开 open localhost

用法

运行插件测试

  • PHPUnit

    vendor/bin/phpunit
  • PHPSpec

    vendor/bin/phpspec run
  • Behat(非 JS 场景)

    vendor/bin/behat --strict --tags="~@javascript"
  • Behat(JS 场景)

    1. 安装 Symfony CLI 命令.

    2. 启动 Headless Chrome

    google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1
    1. 安装 SSL 证书(仅需要一次)并在 127.0.0.1:8080 上运行测试应用的 web 服务器
    symfony server:ca:install
    APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public --daemon
    1. 运行 Behat
    vendor/bin/behat --strict --tags="@javascript"
  • 静态分析

    • Psalm

      vendor/bin/psalm
    • PHPStan

      vendor/bin/phpstan analyse -c phpstan.neon -l max src/  
  • 编码规范

    vendor/bin/ecs check

使用您的插件打开 Sylius

  • 使用 test 环境

    (cd tests/Application && APP_ENV=test bin/console sylius:fixtures:load)
    (cd tests/Application && APP_ENV=test bin/console server:run -d public)
  • 使用 dev 环境

    (cd tests/Application && APP_ENV=dev bin/console sylius:fixtures:load)
    (cd tests/Application && APP_ENV=dev bin/console server:run -d public)