All Projects → demyan112rv → mountebank-api-php

demyan112rv / mountebank-api-php

Licence: MIT License
Working with mountebank api it's easy!

Programming Languages

PHP
23972 projects - #3 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to mountebank-api-php

springmock
alternative spring mocking infrastructure
Stars: ✭ 22 (+29.41%)
Mutual labels:  mock, mocking
chrome-extension-mocker
The most convenient tool to mock requests for axios, with built-in Chrome extension support.
Stars: ✭ 37 (+117.65%)
Mutual labels:  mock, mocking
mockingbird
🐦 Decorator Powered TypeScript Library for Creating Mocks
Stars: ✭ 70 (+311.76%)
Mutual labels:  mock, mocking
Http Fake Backend
Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 253 (+1388.24%)
Mutual labels:  mock, mocking
Mockaco
🐵 HTTP mock server, useful to stub services and simulate dynamic API responses, leveraging ASP.NET Core features, built-in fake data generation and pure C# scripting
Stars: ✭ 213 (+1152.94%)
Mutual labels:  mock, mocking
go-github-mock
A library to aid unittesting code that uses Golang's Github SDK
Stars: ✭ 63 (+270.59%)
Mutual labels:  mock, mocking
ineeda
Mocking library for TypeScript and JavaScript using Proxies!
Stars: ✭ 53 (+211.76%)
Mutual labels:  mock, mocking
Axios Mock Adapter
Axios adapter that allows to easily mock requests
Stars: ✭ 2,832 (+16558.82%)
Mutual labels:  mock, mocking
open-api-mocker
A mock server based in OpenAPI Specification
Stars: ✭ 58 (+241.18%)
Mutual labels:  mock, mocking
laika
Log, test, intercept and modify Apollo Client's operations
Stars: ✭ 99 (+482.35%)
Mutual labels:  mock, mocking
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+20182.35%)
Mutual labels:  mock, mocking
umock-c
A pure C mocking library
Stars: ✭ 29 (+70.59%)
Mutual labels:  mock, mocking
Faker
Provides fake data to your Android apps :)
Stars: ✭ 234 (+1276.47%)
Mutual labels:  mock, mocking
aem-stubs
Tool for providing sample data for AEM applications in a simple and flexible way. Stubbing server on AEM, no separate needed.
Stars: ✭ 40 (+135.29%)
Mutual labels:  mock, mocking
Okhttp Json Mock
Mock your datas for Okhttp and Retrofit in json format in just a few moves
Stars: ✭ 231 (+1258.82%)
Mutual labels:  mock, mocking
dexopener
An Android library that provides the ability to mock your final classes on Android devices.
Stars: ✭ 112 (+558.82%)
Mutual labels:  mock, mocking
Pester
Pester is the ubiquitous test and mock framework for PowerShell.
Stars: ✭ 2,620 (+15311.76%)
Mutual labels:  mock, mocking
Mockiato
A strict, yet friendly mocking library for Rust 2018
Stars: ✭ 229 (+1247.06%)
Mutual labels:  mock, mocking
MockAlamofire
A simple example showing how to override the URLProtocol to return mock data on Alamofire responses. Helpful if you are looking for a simple way to mock an Alamofire response, with out any additional dependencies.
Stars: ✭ 22 (+29.41%)
Mutual labels:  mock, mocking
CNeptune
CNeptune improve productivity & efficiency by urbanize .net module with meta-code to lay foundation for frameworks
Stars: ✭ 30 (+76.47%)
Mutual labels:  mock, mocking

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.

Install

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);
$response->setConfig([
    'statusCode' => 200,
    'headers' => ['Content-Type' => 'application/json'],
    'body' => ['foo' => 'bar']
])->addBehavior(
    (new Behavior())
        ->setType(Behavior::TYPE_WAIT)
        ->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();
$stub->addResponse($response)->addPredicate($predicate);

Imposter for Mountebank

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

$imposter = new Imposter();
$imposter->setName('Test imposter')
    ->setPort(1234)
    ->setProtocol(Imposter::PROTOCOL_HTTP)
    ->addStub($stub);

// Mountbank config client
$mb = new Mountebank(new \GuzzleHttp\Client());
$mb->setHost('http://localhost')->setPort(2525);

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

// remove all imposters
$response = $mb->removeImposters();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].