Completed
Push — master ( 1f0d30...75b576 )
by Russell
02:22
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 Method

Rating   Name   Duplication   Size   Complexity  
A testIsExpressionValid() 0 10 1
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
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
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('$..'));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<JSONTextTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
22
        $this->assertTrue($field->isValidExpression('$.[2]'));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<JSONTextTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
23
        $this->assertTrue($field->isValidExpression('$.cars.american[*]'));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<JSONTextTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
24
        $this->assertFalse($field->isValidExpression('$'));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<JSONTextTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
        $this->assertFalse($field->isValidExpression('$[2]'));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<JSONTextTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
    }
27
}
28