ruby 禁用mailcatcher命令行消息

cgvd09ve  于 2023-04-20  发布在  Ruby
关注(0)|答案(1)|浏览(106)

当使用mailcatcher来测试邮件发送时,我使用codeception和codeception-mailcatcher-module。一切都以Github动作运行,我触发了这样的东西:

php vendor/bin/codecept run "tests/codeception/acceptance/product1/backend/RecommendCest" -v --html --fail-fast

这样我就可以在命令行上得到一个非常紧凑的测试消息显示。
当测试包含邮件测试时,mailcatcher会提示大量以下消息:

*   Trying 127.0.0.1:1080...
* Connected to 127.0.0.1 (127.0.0.1) port 1080 (#0)
> GET /messages HTTP/1.0
Host: 127.0.0.1:1080
User-Agent: GuzzleHttp/7

* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 310
< X-Content-Type-Options: nosniff
< Connection: close
< Server: thin 1.5.1 codename Straight Razor
< 
* Closing connection 0
* Hostname 127.0.0.1 was found in DNS cache
*   Trying 127.0.0.1:1080...
* Connected to 127.0.0.1 (127.0.0.1) port 1080 (#1)
> GET /messages/2.json HTTP/1.0
Host: 127.0.0.1:1080
User-Agent: GuzzleHttp/7

如何使其不那么冗长或完全禁用?
这里是acceptance.suite.yml

class_name: AcceptanceTester
params:
  - parameters.yml
step_decorators:
  - Codeception\Step\TryTo
modules:
  enabled:
    - Asserts
    - Helper\Acceptance
    - DbHelper
    - Filesystem
    - MailCatcher
  config:
    MailCatcher:
      url: "http://127.0.0.1"
      port: "1080"
      guzzleRequestOptions:
        verify: false
        debug: true
        version: 1.0
    Joomla\Browser\JoomlaBrowser:
      url: "http://127.0.0.1:8000/"
      browser: "chrome"
      curl:
        CURLOPT_TIMEOUT: 90
      restart: false
      clear_cookies: true
      window_size: 1920x1600
      connection_timeout: 10
      request_timeout: 10
      upload_max_filesize: 20M
      post_max_size: 21M
      port: 9515 
      capabilities:
        unexpectedAlertBehaviour: "accept"
        "goog:chromeOptions":
          prefs:
            download.default_directory: "%DOWNLOAD_DIR%"
            download.prompt_for_download: false
          args: [
              "headless=new",
              "whitelisted-ips",
              "disable-gpu",
              "no-sandbox",
              "window-size=1920x1600",
              "--disable-notifications",
              "--disable-dev-shm-usage",
            ]

      database host: "127.0.0.1" 
      database user: "root" 
      database password: "root" 
      database name: "%DBNAME%"
      database type: "mysqli"
      database prefix: "jos_" 
      install sample data: "no" 
      sample data: "Default English (GB) Sample Data" 
      admin email: "info@xxx.com"
      name: "admin" 
      username: "admin" 
      password: "123456789" 
      language: "English (United Kingdom)" 
      timeout: 10
      log_js_errors: true

error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED"
35g0bw71

35g0bw711#

如果我从输出格式的猜测是正确的,这是curl HTTP客户端的详细日志记录。从您的描述中,它可能是acceptance.suite.ymlcodeception-mailcatcher-moduleguzzleRequestOptions:debug设置:

modules:
  enabled:
    # ...
    - MailCatcher
  config:
    MailCatcher:
      url: "http://127.0.0.1"
      port: "1080"
      guzzleRequestOptions:
        verify: false
        debug: true
        ###########
        version: 1.0

将其更改为false:

guzzleRequestOptions:
        verify: false
        debug: false
        ############
        version: 1.0

而且这些消息不应该再出现了。

相关问题