Completed
Push — master ( 291e85...e418c2 )
by Guillaume
02:40
created

JsonValidatorTest::testInvalidJson()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace Hogosha\Monitor\Validator;
4
5
/**
6
 * @author Guillaume Cavana <[email protected]>
7
 */
8
class JsonValidatorTest extends \PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * testCheckFalse
12
     * @expectedException Hogosha\Monitor\Exception\ValidatorException
13
     * @expectedExceptionMessage PropertyAccessor requires a graph of objects or arrays to operate on, but it found type "string" while trying to traverse path "name.toto" at property "toto".
14
     */
15
    public function testException()
16
    {
17
        $htmlValidator = new JsonValidator();
18
        $htmlValidator->check('{"name": "Chuck Norris"}', 'name.toto');
19
    }
20
21
    /**
22
     * testCheckFalse
23
     * @expectedException Hogosha\Monitor\Exception\ValidatorException
24
     * @expectedExceptionMessage This json is not valid
25
     */
26
    public function testInvalidJson()
27
    {
28
        $htmlValidator = new JsonValidator();
29
        $htmlValidator->check('{"name": "Chuck Norris"', 'name.toto');
30
    }
31
}
32