Esempio n. 1
0
 /**
  * Test basic entity delete
  */
 public function testDelete()
 {
     $obj_http = $this->initTestHttpClient('https://datastore.googleapis.com/v1/projects/DatasetTest:commit', ['json' => (object) ['mode' => 'NON_TRANSACTIONAL', 'mutations' => [(object) ['delete' => (object) ['path' => [(object) ['kind' => 'Test', 'id' => '123456789']], 'partitionId' => (object) ['projectId' => self::TEST_PROJECT]]]]]]);
     $obj_gateway = $this->initTestGateway()->setHttpClient($obj_http);
     $obj_store = new \GDS\Store('Test', $obj_gateway);
     $obj_entity = (new GDS\Entity())->setKeyId('123456789');
     $obj_store->delete([$obj_entity]);
     $this->validateHttpClient($obj_http);
 }
 /**
  * Test delete Request
  */
 public function testDeleteRequest()
 {
     $obj_gateway = new GDS\Gateway\GoogleAPIClient($this->setupTestClient(), 'Dataset');
     $obj_store = new \GDS\Store('Film', $obj_gateway);
     $this->expectRequest('https://www.googleapis.com/datastore/v1beta2/datasets/Dataset/commit', '{"mode":"NON_TRANSACTIONAL","mutation":{"delete":[{"path":[{"kind":"Film","name":"B2TF"}]}]}}');
     $obj_entity = $obj_store->createEntity();
     $obj_entity->setKeyName('B2TF');
     $obj_store->delete($obj_entity);
 }