Пример #1
0
    public function testSerialize()
    {
        $property = new Property('id', Property::TYPE_INTEGER, 'Foobar');
        $property->setFormat(Property::FORMAT_INT64);
        $property->setDefaultValue(12);
        $property->setEnum(array(12, 24, 48));
        $property->setMinimum(8);
        $property->setMaximum(20);
        $content = <<<JSON
{
  "id": "id",
  "type": "integer",
  "format": "int64",
  "description": "Foobar",
  "defaultValue": 12,
  "enum": [12, 24, 48],
  "minimum": 8,
  "maximum": 20
}
JSON;
        $this->assertRecordEqualsContent($property, $content);
    }
Пример #2
0
 public function addProperty(Property $property)
 {
     $this->properties->{$property->getId()} = $property;
 }