/** * @test */ public function initializePropertyMappingConfigurationDoesNothingIfTrustedPropertiesAreNotSet() { $request = $this->getMockBuilder(\TYPO3\Flow\Mvc\ActionRequest::class)->setMethods(array('getInternalArgument'))->disableOriginalConstructor()->getMock(); $request->expects($this->any())->method('getInternalArgument')->with('__trustedProperties')->will($this->returnValue(NULL)); $arguments = new \TYPO3\Flow\Mvc\Controller\Arguments(); $requestHashService = new \TYPO3\Flow\Mvc\Controller\MvcPropertyMappingConfigurationService(); $requestHashService->initializePropertyMappingConfigurationFromRequest($request, $arguments); // dummy assertion to avoid PHPUnit warning $this->assertTrue(TRUE); }
/** * @test */ public function trustedPropertiesConfigurationDoesNotIgnoreWildcardConfigurationInController() { $entity = new TestEntity(); $entity->setName('Foo'); $this->persistenceManager->add($entity); $identifier = $this->persistenceManager->getIdentifierByObject($entity); $trustedPropertiesService = new \TYPO3\Flow\Mvc\Controller\MvcPropertyMappingConfigurationService(); $trustedProperties = $trustedPropertiesService->generateTrustedPropertiesToken(array('entity[__identity]', 'entity[subEntities][0][content]', 'entity[subEntities][0][date]', 'entity[subEntities][1][content]', 'entity[subEntities][1][date]')); $form = array('entity' => array('__identity' => $identifier, 'subEntities' => array(array('content' => 'Bar', 'date' => '1.1.2016'), array('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()); }