generateTrustedPropertiesToken() public méthode

Generate a request hash for a list of form fields
public generateTrustedPropertiesToken ( array $formFieldNames, string $fieldNamePrefix = '' ) : string
$formFieldNames array Array of form fields
$fieldNamePrefix string
Résultat string trusted properties token
 /**
  * @test
  */
 public function trustedPropertiesConfigurationDoesNotIgnoreWildcardConfigurationInController()
 {
     $entity = new TestEntity();
     $entity->setName('Foo');
     $this->persistenceManager->add($entity);
     $identifier = $this->persistenceManager->getIdentifierByObject($entity);
     $trustedPropertiesService = new MvcPropertyMappingConfigurationService();
     $trustedProperties = $trustedPropertiesService->generateTrustedPropertiesToken(['entity[__identity]', 'entity[subEntities][0][content]', 'entity[subEntities][0][date]', 'entity[subEntities][1][content]', 'entity[subEntities][1][date]']);
     $form = ['entity' => ['__identity' => $identifier, 'subEntities' => [['content' => 'Bar', 'date' => '1.1.2016'], ['content' => 'Baz', 'date' => '30.12.2016']]], '__trustedProperties' => $trustedProperties];
     $request = Request::create(new Uri('http://localhost/test/mvc/actioncontrollertestc/' . $identifier . '/update'), 'POST', $form);
     $response = $this->browser->sendRequest($request);
     $this->assertSame('Entity "Foo" updated', $response->getContent());
 }
 /**
  * Render the request hash field
  *
  * @return string the hmac field
  */
 protected function renderTrustedPropertiesField()
 {
     $formFieldNames = $this->viewHelperVariableContainer->get(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, 'formFieldNames');
     $requestHash = $this->mvcPropertyMappingConfigurationService->generateTrustedPropertiesToken($formFieldNames, $this->getFieldNamePrefix());
     return '<input type="hidden" name="' . $this->prefixFieldName('__trustedProperties') . '" value="' . htmlspecialchars($requestHash) . '" />' . chr(10);
 }