2017 © Pedro Peláez
 

library codeception-json-schema

Simple validate response by json schema

image

alexpts/codeception-json-schema

Simple validate response by json schema

  • Saturday, August 12, 2017
  • by alexpts
  • Repository
  • 1 Watchers
  • 0 Stars
  • 42 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

json-schema

SensioLabsInsight, (*1)

Build Status Code Coverage Code Climate Scrutinizer Code Quality, (*2)

Simple validator json schema + module for codeception., (*3)

Example (without codeception):, (*4)

use \PTS\JsonSchema;

$validator = new JsonSchema;
$schemasDir = dirname(__DIR__). '/schemas/';
$validator->loadAllSchemas($schemasDir);
$responseBody = \json_encode(['id' => 1, 'name' => 'Alex']);

$errorsMessage = $validator->validateJsonSchema($responseBody, 'v1/users/user-model.json');
if (null !== $errorsMessage) {
    throw \Exception($errorsMessage);
}

Example (codeception module):, (*5)

class RegionsCest
{
    public function _before(FunctionalTester $I)
    {
        $I->haveHttpHeader('Authorization', 'Bearer xxx');
    }

    public function getRegionsList(FunctionalTester $I)
    {
        $I->sendGET('/v1/regions/');
        $I->seeResponseCodeIs(200);
        $I->validateJsonSchema($I->grabResponse(), '/v1/regions/get.json');
    }
}

The Versions

12/08 2017

dev-master

9999999-dev https://github.com/alexpts/codeception-json-schema

Simple validate response by json schema

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar alexpts

validator validate codeception json-schema

12/08 2017

1.0.0

1.0.0.0 https://github.com/alexpts/codeception-json-schema

Simple validate response by json schema

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar alexpts

validator validate codeception json-schema