You are here

public function RestfulDiscoveryTestCase::testDiscoveryPage in RESTful 7.2

Test the discovery page.

File

tests/RestfulDiscoveryTestCase.test, line 37
Contains RestfulDiscoveryTestCase

Class

RestfulDiscoveryTestCase
Class RestfulDiscoveryTestCase.

Code

public function testDiscoveryPage() {
  $request = $this
    ->httpRequest('api');
  $body = drupal_json_decode($request['body']);
  $this
    ->assertTrue(!empty($body['self']), 'The discovery plugin exposed the plugins.');

  // Disable the plugin and test a 404.
  variable_set('restful_enable_discovery_resource', FALSE);
  $request = $this
    ->httpRequest('api');
  $body = drupal_json_decode($request['body']);
  $this
    ->assertEqual($body['status'], 404, 'The discovery plugin is disabled.');
  variable_set('restful_enable_discovery_resource', TRUE);
}