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

JSONTextTest::testIsExpressionValid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
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