定制 jrmadsen67/mahana-mailinator-test 二次开发

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

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

jrmadsen67/mahana-mailinator-test

Composer 安装命令:

composer require jrmadsen67/mahana-mailinator-test

包简介

A PHPUnit extension for testing emails via the Mailinator API

README 文档

README

Software License

A PHPUnit extension for testing emails via the Mailinator API

Requirements

You need to have the cURL-extension installed on your server. PHP 5.4 will suffice.

Mahana Mailinator Test depends on the Mahana Mailinator API library (will install with composer, or can be found here: https://github.com/jrmadsen67/MahanaMailinatorAPI)

Installation

composer require jrmadsen67/mahana-mailinator-test

Usage

Mahana Mailinator Test is a PHPUnit extension used for functional email testing against the Mailintor API. You will need to get an api token at https://www.mailinator.com/settings.jsp.

In your tests, create a Mahana Mailinator API object with your token, then pass that object to your Mahana Mailinator Test object:

use jrmadsen67\MahanaMailinatorAPI\MahanaMailinatorAPI;
use jrmadsen67\MahanaMailinatorAPI\MahanaMailinatorTest;

$mahanaMailinatorAPI = new MahanaMailinatorAPI($token);
$mahanaMailinatorTest = new MahanaMailinatorTest($mahanaMailinatorAPI);

IMPORTANT! You need to send emails via your own mail library. This library will only retreive and test the contents.

Examples:

// inbox value does not require "@mailinator.com" for the API to retrieve.
$inbox = 'mytestbox@mailinator.com';  

//psuedo-code to send an email:
mail_send([
    'to'=>$inbox, 
    'subject' => 'My test subject', 
    'from'=> 'me@test.com', 
    'body' => 'blah, blah, blah', 
]);


// get the email you just sent. this is an array.
$email = $mahanaMailinatorTest->getLastMessage($inbox); 

//start testing
$mahanaMailinatorTest->assertEmailSubjectContains('test', $email);
$mahanaMailinatorTest->assertEmailSubjectEquals('My test subject', $email);
$mahanaMailinatorTest->assertEmailTextContains('blah', $email);

Please read the library source for a full set of functions. (Better specs on the way, I promise!)

统计信息

  • 总下载量: 7.95k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-16