PHPackages                             dxw/codeception-notify-module - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. dxw/codeception-notify-module

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

dxw/codeception-notify-module
=============================

Codeception module for acceptance testing an application that uses Gov.uk Notify

0.2.1(6y ago)03[2 PRs](https://github.com/dxw/codeception-notify-module/pulls)GPL-3.0-or-laterPHPPHP &gt;=7.0

Since Jul 30Pushed 3y ago14 watchersCompare

[ Source](https://github.com/dxw/codeception-notify-module)[ Packagist](https://packagist.org/packages/dxw/codeception-notify-module)[ RSS](/packages/dxw-codeception-notify-module/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (3)Dependencies (4)Versions (7)Used By (0)

codeception-notify-module
=========================

[](#codeception-notify-module)

A Codeception module that extends [phiremock-codeception-extension](https://github.com/mcustiel/phiremock-codeception-extension) for testing applications that call GOV.UK Notify.

The Phiremock extension is loaded as a Composer dependency, so does not need to be installed separately.

Installation
------------

[](#installation)

```
composer require --dev dxw/codeception-notify-module
```

How to use
----------

[](#how-to-use)

Currently the module only tests requests to the Notify email endpoint.

### Setup

[](#setup)

Configure the Phiremock extension in your codeception.yml to start the Phiremock server. You'll need to modify your Notify config so it hits this mock server when in the testing environment.

```
extensions:
    enabled:
        - \Codeception\Extension\Phiremock
    config:
        \Codeception\Extension\Phiremock:
            listen: 127.0.0.1:18080 # defaults to 0.0.0.0:8086
            bin_path: ../vendor/bin # defaults to codeception_dir/../vendor/bin
            logs_path: /var/log/my_app/tests/logs # defaults to codeception's tests output dir
            debug: true # defaults to false
            startDelay: 1 # default to 0
            expectations_path: /my/expectations/path
```

Then enable the Notify module in your suite's configuration file, and configure it so it knows how to talk to the mock server:

```
modules:
    enabled:
        - \dxw\Codeception\Module\Notify:
            host: 127.0.0.1
            port: 18080
            resetBeforeEachTest: true # recommend setting this to true for predictable results
```

### Use

[](#use)

The standard methods defined by the [Phiremock module](https://github.com/mcustiel/phiremock-codeception-extension) are all available. On top of these, there are some Notify-specific ones:

#### expectEmailRequestWithSuccessResponse

[](#expectemailrequestwithsuccessresponse)

Allows you to specify that a request to the email endpoint should receive a 200 response. (It's important to note that the test won't fail if this request is not made - this just tells the mock server what response to supply if it is).

```
$I->expectEmailRequestWithSuccessResponse();
```

You can also specify what the response body should be (in JSON format):

```
$I->expectEmailRequestWithSuccessResponse('{"response":"body"}');
```

#### expectEmailRequestWithFailureResponse

[](#expectemailrequestwithfailureresponse)

Allows you to specify that a request to the email endpoint should receive a 401 response. You can use this if you're handling all failure responses in the same way.

```
$I->expectEmailRequestWithFailureResponse();
```

You can also specify the error code and body that should be returned, e.g.

```
$I->expectEmailRequestWithFailureResponse(403, '{"errors":[{"error":"AuthError", "message":"Invalid token"}]}');
```

Note that the body must be in the format expected by the [AlphaGov\\Notifications\\Exception\\ApiException class](https://github.com/alphagov/notifications-php-client/blob/master/src/Exception/ApiException.php) otherwise the Notify client will error.

#### getRecipientEmailAddresses

[](#getrecipientemailaddresses)

Returns a chronological array of all email addresses that emails have been sent to.

```
$recipients = $I->getRecipientEmailAddresses();
```

#### seeLastEmailWasSentTo

[](#seelastemailwassentto)

Verifies if the last request was sent to the email address you provide.

```
$I->seeLastEmailWasSentTo('address@domain.com');
```

#### seeNotifyReceivedEmailRequests

[](#seenotifyreceivedemailrequests)

Verifies how any email requests have been sent to Notify.

```
$I->seeNotifyReceivedEmailRequests(5)
```

Development
-----------

[](#development)

Install the dependencies:

```
composer install
```

Run the tests:

```
vendor/bin/codecept run unit
```

Run the linter:

```
vendor/bin/php-cs-fixer fix
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~32 days

Total

3

Last Release

2418d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/370665?v=4)[Rob Skilling](/maintainers/RobjS)[@RobjS](https://github.com/RobjS)

![](https://avatars.githubusercontent.com/u/1659723?v=4)[jkeasley](/maintainers/jkeasley)[@jkeasley](https://github.com/jkeasley)

![](https://avatars.githubusercontent.com/u/4721596?v=4)[Matthew Passmore](/maintainers/matpassmore)[@matpassmore](https://github.com/matpassmore)

![](https://avatars.githubusercontent.com/u/71827088?v=4)[Serena Piccioni](/maintainers/serena-piccioni)[@serena-piccioni](https://github.com/serena-piccioni)

---

Top Contributors

[![RobjS](https://avatars.githubusercontent.com/u/370665?v=4)](https://github.com/RobjS "RobjS (22 commits)")

---

Tags

govpress

###  Code Quality

TestsCodeception

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/dxw-codeception-notify-module/health.svg)

```
[![Health](https://phpackages.com/badges/dxw-codeception-notify-module/health.svg)](https://phpackages.com/packages/dxw-codeception-notify-module)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
