Example #1
0
 public function __construct($status, $path)
 {
     $this->status = $status;
     $this->path = $path;
     $this->pathParameters = Property::getComplex('path');
     $this->methods = array();
 }
Example #2
0
 public function testGetId()
 {
     $property = Property::getChoice('test');
     $this->assertEquals('1cb150947b4fb85659239644eeafd2fd', $property->getId());
     $complexFoo = Property::getComplex('foo')->add(Property::getInteger('foo')->setRequired(true))->add(Property::getInteger('bar')->setRequired(true));
     $complexBar = Property::getComplex('bar')->add(Property::getInteger('foo')->setRequired(true))->add(Property::getInteger('baz')->setRequired(true));
     $property = Property::getChoice('test')->add($complexFoo)->add($complexBar);
     $this->assertEquals('0faf795063796275fc246ec2b8c27929', $property->getId());
 }
Example #3
0
 protected function parseComplexType(array $data, $name, $depth)
 {
     $complexType = Property::getComplex($name);
     $properties = isset($data['properties']) ? $data['properties'] : array();
     foreach ($properties as $name => $row) {
         if (is_array($row)) {
             $property = $this->getRecProperty($row, $name, $depth + 1);
             if ($property !== null) {
                 $complexType->add($property);
             }
         }
     }
     if (isset($data['description'])) {
         $complexType->setDescription($data['description']);
     }
     if (isset($data['required']) && is_array($data['required'])) {
         foreach ($data['required'] as $propertyName) {
             $property = $complexType->get($propertyName);
             if ($property instanceof PropertyInterface) {
                 $property->setRequired(true);
             }
         }
     }
     return $complexType;
 }
Example #4
0
 /**
  * @expectedException \RuntimeException
  */
 public function testVisitComplexNoProperties()
 {
     $visitor = new ValidationVisitor();
     $property = Property::getComplex('test');
     $visitor->visitComplex(new \stdClass(), $property, '');
 }
Example #5
0
 public function testVisitComplexNoProperties()
 {
     $visitor = new AssimilationVisitor();
     $property = Property::getComplex('test');
     $this->assertInstanceOf('PSX\\Data\\RecordInterface', $visitor->visitComplex(new \stdClass(), $property, ''));
 }
Example #6
0
 public function testGetTypeName()
 {
     $this->assertEquals('complex', Property::getComplex('test')->getTypeName());
 }
Example #7
0
 public function __construct()
 {
     $this->queryParameters = Property::getComplex('query');
     $this->responses = array();
 }