2017 © Pedro Peláez
 

library unittest-josn-schema

Allows Unit testing of JSON-Schema's against a supplied JSON-Schema schema or an in-schema defined schema

image

barkermn01/unittest-josn-schema

Allows Unit testing of JSON-Schema's against a supplied JSON-Schema schema or an in-schema defined schema

  • Sunday, April 22, 2018
  • by barkermn01
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

UnitTest-JSON-Schema

A simple and easy to use class to aid in the validation and testing of a JSON-schema., (*1)

How to Install

composer require "barkermn01/unittest-josn-schema"

How to use

Sample draft-7 schema for validation

```json+schema { "$schema":"http://json-schema.org/draft-07/schema", "properties":{ "test":{ "type":"string" } } }, (*2)

Package is released in the namespace `UnitTestJSONSchema;`

#### Supply a schema in test cases manually.
```php
$SchemaName = "test.schema.json";
$schemaToTest = file_get_contents(__DIR__ . "/test.schema.json");

$tester = new SchemaTester;
$tester->DefineSchema("http://json-schema.org/draft-07/schema");
$tester->TestSchema($schemaToTest);
$this->assertFalse($tester->hasErrors(), "Schema '{$SchemaName}' failed vailidation: '".$tester->getErrors());

Allow a schema to define it's own schema to be validated against

$SchemaName = "test.schema.json";
$schemaToTest = file_get_contents(__DIR__ . "/test.schema.json");

$tester = new SchemaTester;
$tester->TestSchema($schemaToTest);
$this->assertFalse($tester->hasErrors(), "Schema '{$SchemaName}' failed vailidation: '".$tester->getErrors());

License

Licensed under the Appache-2 license., (*3)

The Versions

22/04 2018

dev-master

9999999-dev

Allows Unit testing of JSON-Schema's against a supplied JSON-Schema schema or an in-schema defined schema

  Sources   Download

Apache-2.0

The Requires

 

by Martin Barker

22/04 2018

1.1.0.x-dev

1.1.0.9999999-dev

Allows Unit testing of JSON-Schema's against a supplied JSON-Schema schema or an in-schema defined schema

  Sources   Download

Apache-2.0

The Requires

 

by Martin Barker

21/04 2018

1.1.0

1.1.0.0

Allows Unit testing of JSON-Schema's against a supplied JSON-Schema schema or an in-schema defined schema

  Sources   Download

Apache-2.0

The Requires

 

by Martin Barker