You are here

protected function RestfulCsrfTokenTestCase::getPath in RESTful 7

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

Get the path for the request.

For non "POST" methods, a new node is created.

Parameters

$method: The HTTP method.

Return value

string The path for the request.

1 call to RestfulCsrfTokenTestCase::getPath()
RestfulCsrfTokenTestCase::checkCsrfRequest in tests/RestfulCsrfTokenTestCase.test
Perform requests without, with invalid and with valid CSRF tokens.

File

tests/RestfulCsrfTokenTestCase.test, line 135
Contains RestfulCsrfTokenTestCase

Class

RestfulCsrfTokenTestCase
@file Contains RestfulCsrfTokenTestCase

Code

protected function getPath($method) {
  if ($method == \RestfulInterface::POST) {
    return 'api/v1.0/articles';
  }
  $settings = array(
    'type' => 'article',
    'title' => $this
      ->randomString(),
  );
  $node = $this
    ->drupalCreateNode($settings);
  return 'api/v1.0/articles/' . $node->nid;
}