You are here

public function FppServicesTest::testFppDelete in Fieldable Panels Panes (FPP) 7

Tests FPP resource Delete.

File

tests/fpp.services.test, line 285
Tests the services resource Fieldable Panels Pane methods and actions.

Class

FppServicesTest
Test the services resource Fieldable Panels Pane methods and actions.

Code

public function testFppDelete() {
  $privileged_user = $this
    ->drupalCreateUser(array(
    'administer services',
    'administer fieldable panels panes',
    'delete fieldable fieldable_panels_pane',
  ));
  $this
    ->drupalLogin($privileged_user);
  $fpp = $this
    ->createFpp();
  $this
    ->servicesDelete($this->endpoint->path . '/fieldable_panels_panes/' . $fpp->fpid);
  $deleted_fieldable_panels_pane = fieldable_panels_panes_load($fpp->fpid);
  $this
    ->assertTrue(empty($deleted_fieldable_panels_pane), 'fieldable panels pane was deleted.', 'fppResource: Deleted');

  // Verify trying to delete a non-existing FPP fails.
  $responseArray = $this
    ->servicesDelete($this->endpoint->path . '/fieldable_panels_panes/' . $fpp->fpid);
  $this
    ->assertNotEqual($responseArray['code'], 200, 'fieldable panels pane was deleted. It shoudlnt have been because it doesnt exist', 'fppResource: Deleted');
}