예제 #1
0
 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));
 }
예제 #2
0
 /**
  * @expectedException \RuntimeException
  */
 public function test_Update_Fails_With_AddProperties()
 {
     $data = $this->getSchemaData();
     unset($data['additionalProperties']);
     $schema = Schema::factory($data);
     $config = array('foo' => 'bar');
     $response = $this->image->update($config, $schema);
     $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $response);
 }
예제 #3
0
 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 a JSON schema for an individual member resource
  *
  * @return Schema
  */
 public function getMemberSchema()
 {
     $data = $this->getClient()->get($this->getSchemaUrl('member'))->send()->json();
     return Schema::factory($data);
 }
 /**
  * @param $data
  */
 public function setItems($data)
 {
     $this->items = Schema::factory($data);
 }