public function test_Deciding_Operation_Type() { $json1 = '{"properties": {"foo": {"type": "string"}, "baz": {"type": "string"}}}'; $schema1 = Schema::factory(json_decode($json1, true)); $property1 = Property::factory(array('type' => 'string', 'name' => 'foo')); $this->assertEquals(OperationType::REPLACE, $schema1->decideOperationType($property1)); $property2 = Property::factory(array('type' => 'string', 'name' => 'username')); $this->assertEquals(OperationType::ADD, $schema1->decideOperationType($property2)); }
public function test_Factory() { $schema = Schema::factory($this->getSchemaData()); $property = Property::factory($this->getPropertyData()); $operation = Operation::factory($schema, $property, OperationType::REPLACE); $this->assertEquals($schema, $operation->getSchema()); $this->assertEquals($property->getPath(), $operation->getPath()); $this->assertEquals($property->getValue(), $operation->getValue()); }
/** * @return bool|Property */ public function getAdditionalProperties() { if (!empty($this->additionalProperties)) { return Property::factory($this->additionalProperties); } return false; }
public function test_Get_Path() { $data = $this->getData(); unset($data['enum'], $data['pattern']); $property = Property::factory($data); $this->assertEquals('/id', $property->getPath()); }