Completed
Pull Request — master (#1)
by Guillaume
07:09
created

JsonValidatorTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 24
rs 10
c 1
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testException() 0 5 1
A testInvalidJson() 0 5 1
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