Пример #1
0
 public function testGetTypeName()
 {
     $this->assertEquals('time', Property::getTime('test')->getTypeName());
 }
Пример #2
0
 public function testVisitTimeDateTime()
 {
     $visitor = new ValidationVisitor();
     $property = Property::getTime('test');
     $this->assertTrue($visitor->visitTime(new \DateTime(), $property, ''));
 }
Пример #3
0
 protected function parseString(array $data, $name)
 {
     $property = null;
     if (isset($data['format'])) {
         if ($data['format'] == 'date') {
             $property = Property::getDate($name);
         } elseif ($data['format'] == 'date-time') {
             $property = Property::getDateTime($name);
         } elseif ($data['format'] == 'duration') {
             $property = Property::getDuration($name);
         } elseif ($data['format'] == 'time') {
             $property = Property::getTime($name);
         }
     }
     if ($property === null) {
         $property = Property::getString($name);
     }
     $this->parseScalar($property, $data);
     return $property;
 }
Пример #4
0
 /**
  * @expectedException \PSX\Data\Schema\ValidationException
  */
 public function testVisitTimeInvalidFormat()
 {
     $visitor = new AssimilationVisitor();
     $property = Property::getTime('test');
     $visitor->visitTime('foo', $property, '');
 }