2017 © Pedro Peláez
 

library leo-http-foundation

Leo assertions for testing HttpFoundation applications

image

peridot-php/leo-http-foundation

Leo assertions for testing HttpFoundation applications

  • Tuesday, February 10, 2015
  • by brianium
  • Repository
  • 3 Watchers
  • 5 Stars
  • 8,275 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 3 Versions
  • 17 % Grown

The README.md

Leo Http Foundation

Leo assertions for use with HttpFoundation, (*1)

Build Status Scrutinizer Code Quality, (*2)

This set of assertions is evolving as needed. Please feel free to submit pull requests and make feature requests., (*3)

Usage

You can add HttpFoundation behavior to Leo by extending the Leo assertion property., (*4)

$assertion = Leo::assertion();
$assertion->extend(new LeoHttpFoundation());

Assertions

->allow(methods, [message])

  • @param array $methods
  • @param string $message [optional]

Checks that the Allowed header is present on the response and that it contains all values passed in the methods array., (*5)

expect($response)->to->allow(['POST', 'GET']);
expect($response)->to->not->allow(['GET']);

->status(status, [message])

  • @param int $status
  • @param string $message [optional]

Asserts that the response status is equal to status., (*6)

expect($response)->to->have->status(200);
expect($response)->to->not->have->status(400);

->json

  • @param bool $assoc [optional]
  • @param int $depth [optional]
  • @param int $options [optional]

A language chain that parses the response body as json and sets it as the subject of the assertion chain. The options parameters for json_decode() may also be included., (*7)

expect($response)->json->to->have->property('name');
expect($response)->json->to->loosely->equal($expected);
expect($response)->json(true, 999, JSON_BIGINT_AS_STRING)->to->equal($expected);

The Versions

10/02 2015

dev-master

9999999-dev

Leo assertions for testing HttpFoundation applications

  Sources   Download

MIT

The Requires

 

The Development Requires

10/02 2015

1.1.0

1.1.0.0

Leo assertions for testing HttpFoundation applications

  Sources   Download

MIT

The Requires

 

The Development Requires

21/12 2014

1.0.0

1.0.0.0

Leo assertions for testing HttpFoundation applications

  Sources   Download

MIT

The Requires

 

The Development Requires