protected function RESTTestBase::enableService

Enables the web service interface for a specific entity type.

Parameters

string|FALSE $resource_type: The resource type that should get web API enabled or FALSE to disable all resource types.

3 calls to RESTTestBase::enableService()
DBLogTest::setUp in drupal/core/modules/rest/lib/Drupal/rest/Tests/DBLogTest.php
Sets up a Drupal site for running functional and integration tests.
DeleteTest::testDelete in drupal/core/modules/rest/lib/Drupal/rest/Tests/DeleteTest.php
Tests several valid and invalid delete requests on all entity types.
ReadTest::testRead in drupal/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php
Tests several valid and invalid read requests on all entity types.

File

drupal/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php, line 131
Definition of Drupal\rest\test\RESTTestBase.

Class

RESTTestBase
Test helper class that provides a REST client method to send HTTP requests.

Namespace

Drupal\rest\Tests

Code

protected function enableService($resource_type) {

  // Enable web API for this entity type.
  $config = config('rest');
  if ($resource_type) {
    $config
      ->set('resources', array(
      $resource_type => $resource_type,
    ));
  }
  else {
    $config
      ->set('resources', array());
  }
  $config
    ->save();

  // Rebuild routing cache, so that the web API paths are available.
  drupal_container()
    ->get('router.builder')
    ->rebuild();

  // Reset the Simpletest permission cache, so that the new resource
  // permissions get picked up.
  drupal_static_reset('checkPermissions');
}