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

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

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

nathanmac/im-codeception-module

最新稳定版本:v1.1

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

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固