Ejemplo n.º 1
0
 public function validateValueAsYaml(ExecutionContext $context)
 {
     try {
         Inline::load($this->value);
     } catch (ParserException $e) {
         $context->setPropertyPath($context->getPropertyPath() . '.value');
         $context->addViolation('This value is not valid YAML syntax', array(), $this->value);
     }
 }
Ejemplo n.º 2
0
 public function testDump()
 {
     $testsForDump = $this->getTestsForDump();
     foreach ($testsForDump as $yaml => $value) {
         $this->assertEquals($yaml, Inline::dump($value), sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml));
     }
     foreach ($this->getTestsForLoad() as $yaml => $value) {
         if ($value == 1230) {
             continue;
         }
         $this->assertEquals($value, Inline::load(Inline::dump($value)), 'check consistency');
     }
     foreach ($testsForDump as $yaml => $value) {
         if ($value == 1230) {
             continue;
         }
         $this->assertEquals($value, Inline::load(Inline::dump($value)), 'check consistency');
     }
 }