2017 © Pedro Peláez
 

library laravel-mail-tester

An extension to Laravel's TestCase which allows you to run unit tests on emails

image

tijmen-wierenga/laravel-mail-tester

An extension to Laravel's TestCase which allows you to run unit tests on emails

  • Thursday, July 28, 2016
  • by TijmenWierenga
  • Repository
  • 1 Watchers
  • 0 Stars
  • 185 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

LaravelMailTester

An extension to Laravel's TestCase which allows you to run unit tests on emails., (*1)

Installation

``` bash composer require tijmen-wierenga/laravel-mail-tester, (*2)


Next, add the trait to the `TestCase` class located at `tests/TestCase`: ``` php use TijmenWierenga\LaravelMailTester\TestsEmail; class TestCase extends Laravel\Lumen\Testing\TestCase { use TestsEmail; ... }

How it works

LaravelMailTester adds an event listener as a plugin when in a testing environment. It tracks when an email is sent, and stores all data in the test case. You can then perform assertions against it., (*3)

Usage

``` php class AuthenticationTest extends TestCase { /** * @test */ public function it_sends_an_email() { // Send an email Mail::raw('Wow, awesome email testing!', function($mail) { $mail->to('tijmen@floown.com'); $mail->from('no-reply@floown.com'); $mail->subject('Read this awesome email'); }, (*4)

$this->assertEmailWasSent()
  ->assertEmailWasSentTo('tijmen@floown.com')
  ->assertEmailWasSentFrom('no-reply@floown.com')
  ->assertEmailBodyContains('awesome email testing')

} } ```, (*5)

More assertions to come., (*6)

License

The MIT License (MIT)., (*7)

The Versions

28/07 2016

dev-master

9999999-dev

An extension to Laravel's TestCase which allows you to run unit tests on emails

  Sources   Download

MIT

28/07 2016

v0.1.2

0.1.2.0

An extension to Laravel's TestCase which allows you to run unit tests on emails

  Sources   Download

MIT

27/07 2016

v0.1.1

0.1.1.0

An extension to Laravel's TestCase which allows you to run unit tests on emails

  Sources   Download

MIT

27/07 2016

v0.1

0.1.0.0

An extension to Laravel's TestCase which allows you to run unit tests on emails

  Sources   Download

MIT