sipsystemgm/parser-command-bundle

简单的解析命令

1.2.3 2021-10-26 11:01 UTC

This package is auto-updated.

Last update: 2024-09-26 17:33:52 UTC


README

这是一个解析命令包。功能在此实现,用于运行解析命令和运行队列管理器

此组件仅用于展示开发方法!!!

安装

% composer require sipsystemgm/parser-command-bundle
// config/bundles.php

return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    ...
    // Insert bundle over there
    Sip\ParserCommand\ParserCommandBundle::class => ['all' => true]
]

配置

# config/packeges/messager.yaml
framework:
    messenger:
        transports:
             # insert parameter
             parser: '%env(MESSENGER_TRANSPORT_DSN)%'
        routing:
            # insert parameter
            'Sip\ParserCommand\Message\ParserQueueMessage': parser
# .env
###> symfony/messenger ###
# Choose one of the transports below
...
# uncomment this page and set you parameters
# MESSENGER_TRANSPORT_DSN=redis://:6379/messages
###< symfony/messenger ###

# insert this block and set your parameters
##> memcached ###
MEMCACHED_HOST=localhost
MEMCACHED_PORT=11211
##> memcached ###
% php bin/console doctrine:migrations:diff
% php bin/console doctrine:migrations:migrate

运行

# run php bin/console parser --help for more details

% php bin/console parser https://some-host 4 20
% php bin/console messenger:consume parser

测试

配置

% composer require --dev phpunit/phpunit symfony/test-pack
% cp .env.test .env.test.local
% cp phpunit.xml.dist phpunit.xml

在文件 .env.test.local 中插入 memcached 块并设置您的参数(如果它们不同)

##> memcached ###
MEMCACHED_HOST=localhost
MEMCACHED_PORT=11211
##> memcached ##

在文件 phpunit.xml 中插入测试路径目录

<testsuite name="Project Test Suite">
    <directory>tests</directory>
    ...
    <directory>vendor/sipsystemgm/parser-command-bundle/tests</directory>
 </testsuite>

运行测试

% composer exec phpunit