summaryrefslogtreecommitdiff
path: root/libs/jsonrpc/tests/Validator/JsonEncodingValidatorTest.php
blob: a1b2b80e6342396ae81db6a2978d5545bacf90b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

use JsonRPC\Validator\JsonEncodingValidator;

require_once __DIR__.'/../../../../vendor/autoload.php';

class JsonEncodingValidatorTest extends PHPUnit_Framework_TestCase
{
    public function testWithValidJson()
    {
        json_encode('{"foo": "bar"}');
        $this->assertNull(JsonEncodingValidator::validate());
    }

    public function testWithJsonError()
    {
        json_encode("\xB1\x31");

        $this->setExpectedException('\JsonRPC\Exception\ResponseEncodingFailureException');
        JsonEncodingValidator::validate();
    }
}