You are here

public function ServicesEntityTestHelper::create in Services Entity API 7.2

Helper to perform a RESTful create of a resource.

Parameters

String $resource: The resource type to operate on.

array $data: The update data to post.

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

1 call to ServicesEntityTestHelper::create()
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 246
Services Entity Tests

Class

ServicesEntityTestHelper
Services Entity Test Helper class.

Code

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