xm/mailer-test-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

xm/mailer-test-bundle

Composer 安装命令:

composer require xm/mailer-test-bundle

包简介

Allows for easy testing of the mailer/emails when using the SwiftMailerBundle.

README 文档

README

Allows for easy testing of the mailer/emails when using the SwiftMailerBundle.

Installation

Step 1: Download the Bundle

This package is not on Packagist, so the repository will need to be added manually in composer.json

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ php composer.phar require --dev xm/mailer-test-bundle

This command requires Composer.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        // ...
        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            // ...
            $bundles[] = new XM\MailerTestBundle\XMMailerTestBundle();
        }
    }
}

Usage

Below is how this bundle would be typically used.

<?php

namespace Tests\AppBundle\EventSubscriber;

use Symfony\Component\EventDispatcher\GenericEvent;
use XM\MailerTestBundle\Test\MailerTestCase;

class EventSubscriberTest extends MailerTestCase
{
    public function testEvent()
    {
        $mailerPlugin = $this->getMailerPlugin();

        $event = new GenericEvent();

        $this->container->get('app.listener')
            ->onEvent($event);

        // make sure email was sent
        $this->assertNotNull($mailerPlugin->beforeSendEvent);
        $this->assertNotNull($mailerPlugin->sendEvent);

        // grab message and make sure it matches what we wanted
        $msg = $mailerPlugin->sendEvent->getMessage();

        $expected = 'Expected Subject';
        $this->assertEquals($expected, $msg->getSubject());

        $this->assertContains('Expected part of email body', $msg->getBody());
    }
}

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固