2017 © Pedro Peláez
 

library laravel-mail-assertions

PHPUnit mail assertions for testing email in Laravel.

image

spinen/laravel-mail-assertions

PHPUnit mail assertions for testing email in Laravel.

  • Friday, March 23, 2018
  • by david.mathews
  • Repository
  • 5 Watchers
  • 25 Stars
  • 40,487 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 7 Open issues
  • 20 Versions
  • 13 % Grown

The README.md

SPINEN's Laravel Mail Assertions

NOTE: This is based off a video titled "Testing Email With Custom Assertions" that Jeffrey Way did on Laracasts.com. If you do not have an account on that site, then you should make one. It is an amazing resource. We have just taken that example & made it an easy-to-install package. Thanks Jeffrey!, (*1)

Latest Stable Version Latest Unstable Version Total Downloads License, (*2)

PHPUnit mail assertions for testing email in Laravel., (*3)

Build Status

Branch Status Coverage Code Quality
Develop Build Status Code Coverage Scrutinizer Code Quality
Master Build Status Code Coverage Scrutinizer Code Quality

Installation

Install the package inside your dev dependencies:, (*4)

$ composer require spinen/laravel-mail-assertions --dev

Configuration

In order for the package to be able to make assertions on your emails, it has to be able to "read" the messages. It does so by parsing the Laravel log, so your mail driver has to be "log" for this package to function., (*5)

Usage

You mixin the assertions with the Spinen\MailAssertions\MailTracking trait. You get the following assertions..., (*6)

  • seeEmailBcc
  • seeEmailCc
  • seeEmailContains
  • seeEmailContentTypeEquals
  • seeEmailCountEquals
  • seeEmailDoesNotContain
  • seeEmailEquals
  • seeEmailFrom
  • seeEmailPriorityEquals
  • seeEmailReplyTo
  • seeEmailSubjectContains
  • seeEmailSubjectDoesNotContain
  • seeEmailSubjectEquals
  • seeEmailTo
  • seeEmailWasNotSent
  • seeEmailWasSent

NOTE: If there was more than 1 email sent, then the assertions look at the last email., (*7)

Example

<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Spinen\MailAssertions\MailTracking;

class ExampleTest extends TestCase
{
    use MailTracking;

    /**
     * A basic functional test example.
     *
     * @return void
     */
    public function testBasicExample()
    {
        $this->visit('/route-that-sends-an-email')
             ->seeEmailWasSent()
             ->seeEmailSubject('Hello World')
             ->seeEmailTo('foo@bar.com')
             ->seeEmailEquals('Click here to buy this jewelry.')
             ->seeEmailContains('Click here');
    }
}

The Versions

23/03 2018

dev-master

9999999-dev

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

23/03 2018
23/03 2018

dev-develop

dev-develop

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

22/03 2018

dev-release/0.3.4

dev-release/0.3.4

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

22/03 2018

dev-feature/Issue18

dev-feature/Issue18

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

16/03 2018
06/03 2018

0.3.2

0.3.2.0

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

30/10 2017

dev-feature/SPINEN-36

dev-feature/SPINEN-36

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

12/09 2017

0.3.1

0.3.1.0

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

01/08 2017

0.3.0

0.3.0.0

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

18/03 2017

dev-shift-2349

dev-shift-2349

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

17/03 2017

0.2.0

0.2.0.0

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

26/08 2016

0.1.1

0.1.1.0

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

24/08 2016

0.1.0

0.1.0.0

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

24/08 2016

dev-feature/checkForPriority

dev-feature/checkForPriority

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

19/03 2016

dev-feature/checkForContentType

dev-feature/checkForContentType

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

06/02 2016

0.0.4

0.0.4.0

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

06/02 2016

0.0.3

0.0.3.0

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

06/02 2016

0.0.2

0.0.2.0

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen

03/02 2016

0.0.1

0.0.1.0

PHPUnit mail assertions for testing email in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jimmy Puckett

laravel phpunit email library spinen