You are here

function RestfulGetHandlersTestCase::testGetHandlers in RESTful 7

Same name and namespace in other branches
  1. 7.2 tests/RestfulGetHandlersTestCase.test \RestfulGetHandlersTestCase::testGetHandlers()

Test getting handlers via API.

File

tests/RestfulGetHandlersTestCase.test, line 25
Contains RestfulGetHandlersTestCase

Class

RestfulGetHandlersTestCase
@file Contains RestfulGetHandlersTestCase

Code

function testGetHandlers() {
  $title = $this
    ->randomName();
  $settings = array(
    'type' => 'article',
    'title' => $title,
  );
  $node1 = $this
    ->drupalCreateNode($settings);
  $handler = restful_get_restful_handler('articles');
  $this
    ->assertEqual(get_class($handler), 'RestfulExampleArticlesResource');
  $response = $handler
    ->get($node1->nid);
  $result = $response[0];
  $this
    ->assertTrue(!empty($result['self']), '"self" property appears in minor version 0.');
  $handler = restful_get_restful_handler('articles', 1, 1);
  $this
    ->assertEqual(get_class($handler), 'RestfulExampleArticlesResource__1_1');
  $response = $handler
    ->get($node1->nid);
  $result = $response[0];
  $this
    ->assertTrue(empty($result['self']), '"self" property does not appear in minor version 1.');
}