定制 nathanmac/im-codeception-module 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nathanmac/im-codeception-module

Composer 安装命令:

composer require nathanmac/im-codeception-module

包简介

Test messaging services in your Codeception acceptance tests

README 文档

README

Latest Stable Version License

This module will let you test messages that are sent during your Codeception acceptance tests.

Installation

Begin by installing this package through Composer. Edit your project's composer.json file to require nathanmac/im-codeception-module.

{
    "require-dev": {
        "codeception/codeception": "*",
        "nathanmac/im-codeception-module": "~1.0"
    }
}

Next, update Composer from the Terminal:

composer update

Then enable it in your suite configuration with the following settings

Configuration

The configuration settings depending on which queueing service is being used, all the options are listed here. Refer to the configuration examples below to identify the configuration options required for your chosen service.

  • service - the messaging service.
  • token - API token and/or Access Token.
  • room - The room/channel id for the messaging service.

N.B. The API key for HipChat must be an users API token in order to provide sufficient access the last messages in a given room, however if you are just looking to send a messages to the service a room API token will be sufficient to send the message. Consult the HipChat API documentation for clarification on this topic.

Examples

Example Configuration (hipchat)

 modules:
   enabled: [IM]
    config:
       IM:
          service: 'hipchat'
          token: API_TOKEN
          room: ROOM_ID

Example Usage

<?php
$I = new IMGuy($scenario);
$I->wantTo('grab the recent messages on the IM server and run some tests');

$message = $I->grabLastInstantMessage();
$I->seeInLastInstantMessageFrom('Tester');
$I->dontSeeInLastInstantMessageFrom('Codeception');
$I->seeInLastInstantMessageContent('Testing has been completed with no issues.');
$I->dontSeeInLastInstantMessageContent('Random Message not there');
$I->seeInLastInstantMessageColor('yello');
$I->dontSeeInLastInstantMessageColor('red');
$date = $I->grabLastInstantMessageDate();
$I->seeInLastInstantMessageDate('2014-10-21T16:41:48.657455+00:00');
$I->dontSeeInLastInstantMessageDate('2015-10-21T16:41:48.657455+00:00');

$I->sendInstantMessage("Testing has been completed with no issues.", array('color' => 'yellow', 'notify' => true));

Actions

sendInstantMessage

Simple method for sending a messages to an messaging service.

<?php
$I->sendInstantMessage('Testing message to be send to IM service.', array('color' => 'red', 'notify' => true);
?>
  • Param string $message Message to be sent.
  • Param array $options Depends on service, for HipChat these include the color and the notify option.

grabLastInstantMessage

Grabber method to return the last messages on the service.

<?php
$messages = $I->grabLastInstantMessage();
?>

grabLastInstantMessageFrom

Grabber method to return the from field of the last message.

<?php
$from = $I>grabLastInstantMessageFrom();
?>

seeInLastInstantMessageFrom

Checks whether the last messages from address matches.

<?php
$I->seeInLastInstantMessageFrom('Codeception');
?>

dontSeeInLastInstantMessageFrom

Checks whether the last messages from address does not match.

<?php
$I->dontSeeInLastInstantMessageFrom('Codeception');
?>

grabLastInstantMessageContent

Grabber method to return the content/text of the last message.

<?php
$content = $I->grabLastInstantMessageContent();
?>

seeInLastInstantMessageContent

Checks whether the last messages content/text matches.

<?php
$I->seeInLastInstantMessageContent('Hello this is the messages I am expecting to see.');
?>

dontSeeInLastInstantMessageContent

Checks whether the last messages content/text does not match.

<?php
$I->dontSeeInLastInstantMessageContent('Hello this is the messages I am not expecting to see.');
?>

grabLastInstantMessageColor

Grabber method to return the color of the last message.

<?php
$color = $I->grabLastInstantMessageColor();
?>

seeInLastInstantMessageColor

Checks whether the last messages color matches.

<?php
$I->seeInLastInstantMessageColor('red');
?>

dontSeeInLastInstantMessageColor

Checks whether the last messages color does not match.

<?php
$I->dontSeeInLastInstantMessageColor('red');
?>

grabLastInstantMessageDate

Grabber method to return the date/time of the last message.

<?php
$date = $I->grabLastInstantMessageDate();
?>

seeInLastInstantMessageDate

Checks whether the last messages date matches.

<?php
$I->seeInLastInstantMessageDate('2014-10-13T16:30:48.657455+00:00');
?>

dontSeeInLastInstantMessageDate

Checks whether the last messages date does not match.

<?php
$I->dontSeeInLastInstantMessageDate('2015-11-13T16:30:48.657455+00:00');
?>

License

Released under the same license as Codeception: MIT

nathanmac/im-codeception-module 适用场景与选型建议

nathanmac/im-codeception-module 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 318 次下载、GitHub Stars 达 3, 最近一次更新时间为 2014 年 10 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 nathanmac/im-codeception-module 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nathanmac/im-codeception-module 我们能提供哪些服务?
定制开发 / 二次开发

基于 nathanmac/im-codeception-module 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 318
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-23