| 1 | <?php |
||
| 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 |