Coder Social home page Coder Social logo

drakakisgeo / mailtester Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 13.35 MB

A Laravel package with PHPunit assertions to test Emails generated by Mailcatcher.

License: MIT License

PHP 100.00%
laravel testing email mailcatcher phpunit-assertions

mailtester's Introduction

Mail Tester

Latest Version on Packagist Software License Build Status Quality Score Total Downloads

A package to help with acceptance Email testing. The goal is to add usefull PHPunit assertions in a Trait that you can include when there is a need to test emails that are fired from acceptance testing packages like Laravel Dusk.

Install

This package assumes that you've already installed Mailcatcher. You can check this tutorial on how to install it to your system.

Via Composer

$ composer require drakakisgeo/mailtester

Laravel 5.*

After updating composer, add the ServiceProvider to the providers array in config/app.php

Drakakisgeo\Mailtester\MailtesterServiceProvider::class,

Copy the package config to your local config with the publish command:

$ php artisan vendor:publish --provider="Drakakisgeo\Mailtester\MailtesterServiceProvider"

Instructions

Include the InteractsWithMailCatcher Trait in your test and make sure that your test extends the Laravel's Testcase class. Immediately you have access to the following methods:

Email was send

  • assertEmailIsSent()

Email subject contains a $string

  • assertEmailFirstSubjectContains()
  • assertEmailLastSubjectContains()
  • assertEmailNthSubjectContains()

Email subject equals a $string

  • assertEmailFirstSubjectEquals()
  • assertEmailLastSubjectEquals()
  • assertEmailNthSubjectEquals()
  • assertEmailSubjectEquals()

Email Html body contains a $string

  • assertEmailFirstHtmlContains()
  • assertEmailLastHtmlContains()
  • assertEmailNthHtmlContains()
  • assertEmailHtmlContains()

Email Text body contains a $string

  • assertEmailFirstTextContains()
  • assertEmailLastTextContains()
  • assertEmailNthTextContains()
  • assertEmailTextContains()

Email sender is the target $email

  • assertEmailFirstSenderEquals()
  • assertEmailLastSenderEquals()
  • assertEmailNthSenderEquals()
  • assertEmailSenderEquals()

Email recipient is the target $email

  • assertEmailFirstRecipientsContain()
  • assertEmailLastRecipientsContain()
  • assertEmailNthRecipientsContain()
  • assertEmailRecipientsContain()

Email Cc is the target $email

  • assertEmailFirstCcContain()
  • assertEmailLastCcContain()
  • assertEmailNthCcContain()
  • assertEmailCcContain()

Email Bcc is the target $email

  • assertEmailFirstBccContain()
  • assertEmailLastBccContain()
  • assertEmailNthtBccContain()
  • assertEmailBccContain()

Email Attachment is the target $file

  • Soon!

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

mailtester's People

Contributors

dependabot[bot] avatar drakakisgeo avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

rakhithjk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.