PHPackages                             rezzza/json-api-behat-extension - 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. rezzza/json-api-behat-extension

Abandoned → [https://github.com/rezzza/rest-api-behat-extension](/?search=https%3A%2F%2Fgithub.com%2Frezzza%2Frest-api-behat-extension)Behat-extension[Testing &amp; Quality](/categories/testing)

rezzza/json-api-behat-extension
===============================

Rest Api Extension for Behat

v8.1.1(4y ago)362.9k26[5 PRs](https://github.com/rezzza/rest-api-behat-extension/pulls)MITPHPPHP &gt;=7.2CI failing

Since Feb 17Pushed 1y ago9 watchersCompare

[ Source](https://github.com/rezzza/rest-api-behat-extension)[ Packagist](https://packagist.org/packages/rezzza/json-api-behat-extension)[ Docs](https://github.com/ubirak/rest-api-behat-extension)[ RSS](/packages/rezzza-json-api-behat-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (17)Versions (38)Used By (0)

RestApiExtension for Behat
==========================

[](#restapiextension-for-behat)

- [Branch behat2](https://github.com/ubirak/rest-api-behat-extension/tree/behat-2.x) : **Behat 2.x**
- [Branch master](https://github.com/ubirak/rest-api-behat-extension/tree/master) : **Behat 3.x**

[![Build Status](https://camo.githubusercontent.com/1b5ff4cff221f75708bae74799ebc54cf69625f89af965608593172dd9d0518c/68747470733a2f2f7472617669732d63692e6f72672f75626972616b2f726573742d6170692d62656861742d657874656e73696f6e2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/ubirak/rest-api-behat-extension)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/cbd8e3c6071dc92d8bd4d41867c23bcb4434f10c9aa3fc82062bb183eff85aec/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f75626972616b2f726573742d6170692d62656861742d657874656e73696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/ubirak/rest-api-behat-extension/?branch=master)

For now only JSON api is supported to analyze response, but you could use REST part to perform request on any type of api.

Warning
-------

[](#warning)

From version `7.0`, namespace vendor changed from `Rezzza` to `Ubirak`.

Install
-------

[](#install)

Require the package as a development dependency :

```
composer require --dev ubirak/rest-api-behat-extension
```

Don't forget to load the extension and the context if needed in your `behat.yml` :

```
default:
    extensions:
        Ubirak\RestApiBehatExtension\Extension:
            rest:
                base_url: http://localhost:8888
                store_response: true
    suites:
        default:
            contexts:
                - Ubirak\RestApiBehatExtension\RestApiContext
                - Ubirak\RestApiBehatExtension\Json\JsonContext
```

Then you will need to require in your composer the http client you want to use, and the message factory.

Example:

```
composer require --dev guzzlehttp/psr7 php-http/curl-client

```

Usage
-----

[](#usage)

You can use directly the `JsonContext` or `RestApiContext` by loading them in your behat.yml or use the `RestApiBrowser` and `JsonInspector` by adding them in the construct of your own context.

```
