Download the PHP package zenstruck/mailer-test without Composer

On this page you can find all versions of the php package zenstruck/mailer-test. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mailer-test

zenstruck/mailer-test

CI Status Code Coverage

Alternative, opinionated helpers for testing emails sent with symfony/mailer. This package is an alternative to the FrameworkBundle's MailerAssertionsTrait.

[!TIP] Want to watch a screencast 🎥 about it? Check out symfonycasts.com/mailer-test.

Installation

  1. Install the library:

  2. If not added automatically by symfony/flex, enable ZenstruckMailerTestBundle in your test environment

Usage

You can interact with the mailer in your tests by using the InteractsWithMailer trait in your KernelTestCase/WebTestCase tests:

NOTE: Emails are persisted between kernel reboots within each test. You can reset the collected emails with $this->mailer()->reset().

SentEmails Collection

You can access all the sent emails and filter down to just the ones you want to make assertions on. Most methods are fluent.

Custom TestEmail

The TestEmail class shown above is a decorator for \Symfony\Component\Mime\Email with some assertions. You can extend this to add your own assertions:

Then, use in your tests:

zenstruck/browser Integration

This library provides a zenstruck/browser "Component" and "Extension". Since browser's make HTTP requests to your app, the messages are accessed via the profiler (using symfony/mailer's data collector). Because of this, the InteractsWithMailer trait is not required in your test case. Since the profiler is required, this functionality is not available with PantherBrowser.

MailerComponent

The simplest way to get started testing emails with zenstruck/browser is to use the MailerComponent:

MailerExtension

If many of your tests make email assertions the custom browser using the provided MailerExtension trait:

Now, within your tests using this custom browser, the following email assertion API is available:


All versions of mailer-test with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
symfony/framework-bundle Version ^5.4|^6.0|^7.0
symfony/mailer Version ^5.4|^6.0|^7.0
zenstruck/assert Version ^1.0
zenstruck/callback Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package zenstruck/mailer-test contains the following files

Loading the files please wait ....