You are here

public function ServicesEntityNodeResourceTest::nodeLoad in Services Entity API 7.2

Helper function to load a node and process it so it matches the format used by the service controller.

Parameters

$nid: The node to load.

$clean: If TRUE, use the ServicesResourceControllerClean class.

Return value

The loaded, processed node.

1 call to ServicesEntityNodeResourceTest::nodeLoad()
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 1022
Services Entity Tests

Class

ServicesEntityNodeResourceTest
Tests entity_node services for both the generic and clean controller.

Code

public function nodeLoad($nid, $clean = FALSE) {
  $node = $this
    ->unObject(node_load($nid, NULL, TRUE));
  if ($clean) {
    $node['author'] = $node['uid'];
    if (!empty($node['body'])) {
      $node['body'] = reset($node['body'][$node['language']]);
    }
  }
  return $node;
}