Completed
Push — master ( af643a...1f0d30 )
by Russell
02:42
created

JSONTextTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 15
Bugs 2 Features 6
Metric Value
wmc 1
c 15
b 2
f 6
lcom 0
cbo 2
dl 0
loc 16
rs 10
1
<?php
2
3
/**
4
 * @package silverstripe-jsontext
5
 * @subpackage fields
6
 * @author Russell Michell <[email protected]>
7
 */
8
9
use JSONText\Fields;
10
use JSONText\Exceptions;
11
12
class JSONTextTest extends SapphireTest
13
{
14
    /**
15
     * @todo There are a ton more permutations of a JSONPath regex
16
     */
17
    public function testIsExpressionValid()
18
    {
19
        $field = JSONText\Fields\JSONText::create('MyJSON');
20
        
21
        $this->assertTrue($field->isValidExpression('$..'));
22
        $this->assertTrue($field->isValidExpression('$.[2]'));
23
        $this->assertTrue($field->isValidExpression('$.cars.american[*]'));
24
        $this->assertFalse($field->isValidExpression('$'));
25
        $this->assertFalse($field->isValidExpression('$[2]'));
26
    }
27
}
28