Working with mountebank api it's easy!
Clone or download
Ruslan Demyanovsky
Ruslan Demyanovsky Update composer
Latest commit fcfe00c Nov 12, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Added example Mar 16, 2018
src Fix operator + update composer Nov 9, 2018
tests Fixed default response Apr 16, 2018
.coveralls.yml Added coveralls Feb 25, 2018
.gitignore Update composer Sep 3, 2018
.travis.yml Fixed path to phpstan Feb 25, 2018
Dockerfile Imposter HTTP & HTTPS options + example Docker Feb 7, 2018
LICENSE Initial commit Jan 26, 2018 Type hints, readme Sep 3, 2018
composer.json Update composer Nov 12, 2018
composer.lock Update composer Nov 12, 2018
docker-compose.yml Added example Mar 16, 2018
phpunit.xml Added coveralls Feb 25, 2018

Mountebank API PHP

Latest Stable Version Total Downloads License PHPStan Build Status Coverage Status

What is the Mountebank? See original documentation for understanding.

This package is a php wrapper for mountebank API.


composer require demyan112rv/mountebank-api-php

Usage basics

Response for stub

use Demyan112rv\MountebankPHP\Response;
use Demyan112rv\MountebankPHP\Response\Behavior;
$response = new Response(Response::TYPE_IS);
    'statusCode' => 200,
    'headers' => ['Content-Type' => 'application/json'],
    'body' => ['foo' => 'bar']
    (new Behavior())
        ->setConfig((new Behavior\Config\Wait())->setValue(500))

Predicate for stub

use Demyan112rv\MountebankPHP\Predicate;
use Demyan112rv\MountebankPHP\Predicate\XPath;
use Demyan112rv\MountebankPHP\Predicate\JsonPath;

$predicate = new Predicate(Predicate::OPERATOR_EQUALS);
$predicate->setConfig(['path' => '/test'])
    ->setXPath((new XPath())->setSelector('selector')->setNs(['foo' => 'bar']))
    ->setJsonPath((new JsonPath())->setSelector('selector'));

Stub for imposter

use Demyan112rv\MountebankPHP\Stub;

$stub = new Stub();

Imposter for Mountebank

use Demyan112rv\MountebankPHP\Imposter;
use Demyan112rv\MountebankPHP\Mountebank;

$imposter = new Imposter();
$imposter->setName('Test imposter')

// Mountbank config client
$mb = new Mountebank(new \GuzzleHttp\Client());

// Add new imposter
$response = $mb->addImposter($imposter);

// remove all imposters
$response = $mb->removeImposters();