You are here

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

Tests FPP resource Update fail with no permissions.

File

tests/fpp.services.test, line 263
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 testFppUpdatePermFail() {
  $privileged_user = $this
    ->drupalCreateUser(array(
    'administer services',
  ));
  $this
    ->drupalLogin($privileged_user);
  $fpp = $this
    ->createFpp();

  // Try to update this FPP entity with a user that does not have
  // permission to edit any fieldable_panels_pane content.
  $fpp_update = (array) $fpp;
  $fpp_update['title'] = $this
    ->randomName();
  $responseArray = $this
    ->servicesPut($this->endpoint->path . '/fieldable_panels_panes/' . $fpp->fpid, $fpp_update);
  $this
    ->assertTrue(strpos($responseArray['status'], 'Access denied for user'), 'Updating the fieldable panels pane failed without needed permissions.', 'fppResource: Update');
}