You are here

public function ServicesResourceWebformTests::testEndpointWebformDelete in Webform Service 7.4

Testing webform Delete.

File

tests/ServicesResourceWebformTests.test, line 360

Class

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

Code

public function testEndpointWebformDelete() {

  // Create and log in our privileged user.
  $this->privilegedUser = $this
    ->drupalCreateUser(array(
    'administer services',
    'bypass node access',
  ));
  $this
    ->drupalLogin($this->privilegedUser);

  // Create the form.
  $components = $this->form_components;
  $form = $this
    ->createForm($components);
  $webform = webform_service_resource_load($form->uuid);
  $this
    ->assertTrue(!empty($form->uuid));
  $this
    ->assertTrue(!empty($webform->uuid));

  // Delete the created webform.
  $endpoint = $this->endpoint->path . '/' . $webform->type . '/' . $webform->uuid;
  $this
    ->servicesDelete($endpoint);

  // Now verify it was deleted.
  $webform = webform_service_resource_load($form->uuid, TRUE);
  $this
    ->assertTrue(empty($webform));
}