PHPackages                             mcustiel/phiremock-codeception-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. mcustiel/phiremock-codeception-module

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

mcustiel/phiremock-codeception-module
=====================================

Codeception module for PhireMock. Allows to stub remote services for HTTP requests.

v2.0.0(3y ago)8531.3k—6.7%4[1 PRs](https://github.com/mcustiel/phiremock-codeception-module/pulls)2GPL-3.0-or-laterPHPPHP ^8.0

Since Sep 1Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/mcustiel/phiremock-codeception-module)[ Packagist](https://packagist.org/packages/mcustiel/phiremock-codeception-module)[ RSS](/packages/mcustiel-phiremock-codeception-module/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (15)Used By (2)

phiremock-codeception-module
============================

[](#phiremock-codeception-module)

This codeception module allows you to connect to a Phiremock Server and to interact with it in a semantic way through the codeception actor in your tests.

[![Packagist Version](https://camo.githubusercontent.com/12d9c347e6533dbdd4b2734ef9a3846ea8c6dfde280805f4e106d93ce0ad1657/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6375737469656c2f70686972656d6f636b2d636f646563657074696f6e2d6d6f64756c65)](https://packagist.org/packages/mcustiel/phiremock-codeception-module)[![Build Status](https://camo.githubusercontent.com/c92fc54b8df951402e1c9e39bb51874120302aa51a0e5bab68fa53de858eee20/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6375737469656c2f70686972656d6f636b2d636f646563657074696f6e2d6d6f64756c652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mcustiel/phiremock-codeception-module/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a630d9a26b436d6737fd545be1a8ed4c27b43d39dbc9145316e40df1b0870ab2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6375737469656c2f70686972656d6f636b2d636f646563657074696f6e2d6d6f64756c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mcustiel/phiremock-codeception-module/?branch=master)[![Packagist Downloads](https://camo.githubusercontent.com/91f0ea2f8d7950f09696bd5ca77fb94fb3c974362ca7450379172ee28e1ffb88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d6375737469656c2f70686972656d6f636b2d636f646563657074696f6e2d6d6f64756c65)](https://packagist.org/packages/mcustiel/phiremock-codeception-module)

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

[](#installation)

### Composer:

[](#composer)

```
    "require-dev": {
        "mcustiel/phiremock-codeception-module": "^1.0",
        "guzzlehttp/guzzle": "^6.0"
    }
```

Configuration
-------------

[](#configuration)

You need to enable Phiremock module in your suite's configuration file:

```
modules:
    enabled:
        - Phiremock:
            host: phiremock-myhost.dev # Defaults to localhost
            port: 18080 # Defaults to 8086
            reset_before_each_test: false # if set to true, executes `$I->haveACleanSetupInRemoteService` before each test. Defaults to false
            expectations_path: /path/to/my/expectation/json/files # Defaults to codeception_dir/_data/phiremock-expectations
            client_factory: \My\ClientFactory # Defaults to 'default'
            secure: true # Default: false
            extra_connections:  [] # Default: empty array
```

### Options

[](#options)

#### host

[](#host)

Specifies the host where phiremock-server is listening for requests.

**Default:** localhost

#### port

[](#port)

Specifies the port where phiremock-server is listening for requests.

**Default:** 8086

#### reset\_before\_each\_test

[](#reset_before_each_test)

Determines whether or not phiremock-server must be reset before each test.

**Default:** false

#### expectations\_path

[](#expectations_path)

Specifies the path where expectation json files are located. The files can then be referenced using annotations and will be loaded automatically.

**Default:** codeception\_dir/\_data/phiremock-expectations

#### secure

[](#secure)

A boolean specifying if the connection is secure or not. If it's secure, the request is done through https, otherwise it's done through http.

**Default:** false. The requests to phiremock-client are done through http.

#### extra\_connections

[](#extra_connections)

An list of objects specifying the parameters to request other phiremock-servers. This is useful if you want to have 2 phiremock instances, one listening for http connections, and the other listening for https connections.

**Default:** An empty list, meaning that no other phiremock servers are requested.

##### Example

[](#example)

```
modules:
    enabled:
        - Phiremock:
            host: phiremock-myhost.dev
            port: 18080
            secure: false
            extra_connections:
                secure-host:
                    host: phiremock-myhost.dev
                    port: 18081
                    secure: true
```

Then in the code you can use each connection by name as follows:

```
