You are here

public function ServicesResourceWebformTests::createForm in Webform Service 7.4

Create a new webform.

Parameters

type $components:

Return value

type

4 calls to ServicesResourceWebformTests::createForm()
ServicesResourceWebformTests::testEndpointSubmission in tests/ServicesResourceWebformTests.test
Test creating submissions on a webform.
ServicesResourceWebformTests::testEndpointWebformCreate in tests/ServicesResourceWebformTests.test
Testing webform Create.
ServicesResourceWebformTests::testEndpointWebformDelete in tests/ServicesResourceWebformTests.test
Testing webform Delete.
ServicesResourceWebformTests::testEndpointWebformUpdate in tests/ServicesResourceWebformTests.test
Testing webform Update.

File

tests/ServicesResourceWebformTests.test, line 256

Class

ServicesResourceWebformTests
Run test cases for the endpoint with no authentication turned on.

Code

public function createForm($components = array()) {
  $response = array();
  if ($this->privilegedUser) {
    $types = webform_variable_get('webform_node_types');

    // Get the endpoint.
    $endpoint = $this->endpoint->path . '/' . $types[0];
    $responseArray = $this
      ->servicesPost($endpoint, array(
      'title' => 'testing',
      'body' => array(
        LANGUAGE_NONE => array(
          array(
            'value' => 'testing body',
          ),
        ),
      ),
      'name' => $this->privilegedUser->name,
      'language' => LANGUAGE_NONE,
      'webform' => array(
        'components' => $components,
      ),
    ));
    $response = $responseArray['body'];
  }
  return $response;
}