You are here

public function ServicesEntityTestHelper::update in Services Entity API 7.2

Helper to perform a RESTful update of a resource.

Parameters

String $resource: The resource type to operate on.

int $name: The name of the resource to update

array $data: The update data to put.

int $code: The expected response code (defaults to 200).

1 call to ServicesEntityTestHelper::update()
ServicesEntityNodeResourceTest::testCRUD in tests/services_entity.test
Tests basic CRUD and index actions of a node via the entity_node service.

File

tests/services_entity.test, line 201
Services Entity Tests

Class

ServicesEntityTestHelper
Services Entity Test Helper class.

Code

public function update($resource, $name, $data = array(), $code = 200) {
  $r = $this
    ->servicesPut($this->endpoint->path . '/' . $resource . '/' . $name, $data);
  $this
    ->assertEqual($r['code'], $code, "Received {$code} response code from UPDATE {$resource}/{$name} (actual response=" . $r['code'] . ")");
  return $this
    ->unObject($r['body']);
}