PHP code example of hskrasek / phpunit-jsonschema-assertions

1. Go to this page and download the library: Download hskrasek/phpunit-jsonschema-assertions library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hskrasek / phpunit-jsonschema-assertions example snippets

 php


use HSkrasek\JsonSchema\SchemaAssertions;
use PHPUnit\Framework\TestCase;

class JsonTest extends TestCase
{
    use SchemaAssertions;
    
    public function setUp()
    {
        parent::setUp();

        $this->setupSchemaAssertions();
    }
    
    public function assertMyJsonApiMatchesSchema()
    {
        $this->assertJsonMatchesSchema($json, $pathToSchema);
    }
}