本文整理汇总了PHP中TYPO3\Flow\Property\PropertyMapper::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP PropertyMapper::expects方法的具体用法?PHP PropertyMapper::expects怎么用?PHP PropertyMapper::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Property\PropertyMapper
的用法示例。
在下文中一共展示了PropertyMapper::expects方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
*/
public function setUp()
{
$this->ajaxWidgetComponent = new AjaxWidgetComponent();
$this->mockObjectManager = $this->getMockBuilder(\TYPO3\Flow\Object\ObjectManagerInterface::class)->getMock();
$this->inject($this->ajaxWidgetComponent, 'objectManager', $this->mockObjectManager);
$this->mockComponentContext = $this->getMockBuilder(\TYPO3\Flow\Http\Component\ComponentContext::class)->disableOriginalConstructor()->getMock();
$this->mockHttpRequest = $this->getMockBuilder(\TYPO3\Flow\Http\Request::class)->disableOriginalConstructor()->getMock();
$this->mockHttpRequest->expects($this->any())->method('getArguments')->will($this->returnValue(array()));
$this->mockComponentContext->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->mockHttpRequest));
$this->mockHttpResponse = $this->getMockBuilder(\TYPO3\Flow\Http\Response::class)->disableOriginalConstructor()->getMock();
$this->mockComponentContext->expects($this->any())->method('getHttpResponse')->will($this->returnValue($this->mockHttpResponse));
$this->mockAjaxWidgetContextHolder = $this->getMockBuilder(\TYPO3\Fluid\Core\Widget\AjaxWidgetContextHolder::class)->getMock();
$this->inject($this->ajaxWidgetComponent, 'ajaxWidgetContextHolder', $this->mockAjaxWidgetContextHolder);
$this->mockHashService = $this->getMockBuilder(\TYPO3\Flow\Security\Cryptography\HashService::class)->getMock();
$this->inject($this->ajaxWidgetComponent, 'hashService', $this->mockHashService);
$this->mockDispatcher = $this->getMockBuilder(\TYPO3\Flow\Mvc\Dispatcher::class)->getMock();
$this->inject($this->ajaxWidgetComponent, 'dispatcher', $this->mockDispatcher);
$this->mockSecurityContext = $this->getMockBuilder(\TYPO3\Flow\Security\Context::class)->getMock();
$this->inject($this->ajaxWidgetComponent, 'securityContext', $this->mockSecurityContext);
$this->mockPropertyMappingConfiguration = $this->getMockBuilder(\TYPO3\Flow\Property\PropertyMappingConfiguration::class)->disableOriginalConstructor()->getMock();
$this->inject($this->ajaxWidgetComponent, 'propertyMappingConfiguration', $this->mockPropertyMappingConfiguration);
$this->mockPropertyMapper = $this->getMockBuilder(\TYPO3\Flow\Property\PropertyMapper::class)->disableOriginalConstructor()->getMock();
$this->mockPropertyMapper->expects($this->any())->method('convert')->with('', 'array', $this->mockPropertyMappingConfiguration)->will($this->returnValue(array()));
$this->inject($this->ajaxWidgetComponent, 'propertyMapper', $this->mockPropertyMapper);
}
示例2: importWithArrayPropertiesImportsCorrectly
/**
* @test
*/
public function importWithArrayPropertiesImportsCorrectly()
{
$xmlReader = new \XMLReader();
$result = $xmlReader->open(__DIR__ . '/Fixtures/NodesWithArrayProperties.xml', null, LIBXML_PARSEHUGE);
$this->assertTrue($result);
/** @var \TYPO3\TYPO3CR\Domain\Service\ImportExport\NodeImportService $nodeImportService */
$nodeImportService = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Service\\ImportExport\\NodeImportService', array('persistNodeData'));
$this->inject($nodeImportService, 'propertyMapper', $this->mockPropertyMapper);
$this->inject($nodeImportService, 'securityContext', $this->mockSecurityContext);
$expectedNodeDatas = array(array('identifier' => 'e45e3b2c-3f14-2c14-6230-687fa4696504', 'nodeType' => 'TYPO3.Neos.NodeTypes:Page', 'workspace' => 'live', 'sortingIndex' => '300', 'version' => '3', 'removed' => false, 'hidden' => false, 'hiddenInIndex' => false, 'path' => 'node53a18fb53bdf2', 'pathHash' => '3f1d4fea7c0b21d21098960149de9c80', 'parentPath' => '/', 'parentPathHash' => '6666cd76f96956469e7be39d750cc7d9', 'properties' => array('foos' => array(0 => 'content of entry0', 1 => 'content of entry1'), 'bar' => 'a bar walks into a foo', 'empty' => null, 'bars' => array()), 'accessRoles' => array(), 'dimensionValues' => array('language' => array('en_US'))));
$nodeImportService->expects($this->atLeastOnce())->method('persistNodeData')->will($this->returnCallback(function ($nodeData) use(&$actualNodeDatas) {
unset($nodeData['Persistence_Object_Identifier']);
$actualNodeDatas[] = $nodeData;
return true;
}));
$this->mockPropertyMapper->expects($this->any())->method('convert')->will($this->returnCallback(function ($source, $targetType) {
return array('targetType' => $targetType, 'source' => $source);
}));
$nodeImportService->import($xmlReader, '/');
$this->assertInstanceOf('DateTime', $actualNodeDatas[0]['creationDateTime']);
$this->assertInstanceOf('DateTime', $actualNodeDatas[0]['lastModificationDateTime']);
unset($actualNodeDatas[0]['creationDateTime']);
unset($actualNodeDatas[0]['lastModificationDateTime']);
$this->assertEquals($expectedNodeDatas, $actualNodeDatas);
}
示例3: handleMergesInternalArgumentsWithRoutingMatchResults
/**
* @test
*/
public function handleMergesInternalArgumentsWithRoutingMatchResults()
{
$this->mockHttpRequest->expects($this->any())->method('getArguments')->will($this->returnValue(array('__internalArgument1' => 'request', '__internalArgument2' => 'request', '__internalArgument3' => 'request')));
$this->mockPropertyMapper->expects($this->any())->method('convert')->with('', 'array', $this->mockPropertyMappingConfiguration)->will($this->returnValue(array('__internalArgument2' => 'requestBody', '__internalArgument3' => 'requestBody')));
$this->mockComponentContext->expects($this->atLeastOnce())->method('getParameter')->with('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'matchResults')->will($this->returnValue(array('__internalArgument3' => 'routing')));
$this->mockActionRequest->expects($this->once())->method('setArguments')->with(array('__internalArgument1' => 'request', '__internalArgument2' => 'requestBody', '__internalArgument3' => 'routing'));
$this->dispatchComponent->handle($this->mockComponentContext);
}
示例4: processConvertsValueIfDataTypeIsSpecified
/**
* @test
*/
public function processConvertsValueIfDataTypeIsSpecified()
{
$this->processingRule->setDataType('SomeDataType');
$mockPropertyMappingConfiguration = $this->getMockBuilder('TYPO3\\Flow\\Property\\PropertyMappingConfiguration')->getMock();
$this->processingRule->_set('propertyMappingConfiguration', $mockPropertyMappingConfiguration);
$this->mockPropertyMapper->expects($this->once())->method('convert')->with('Some Value', 'SomeDataType', $mockPropertyMappingConfiguration)->will($this->returnValue('Converted Value'));
$this->mockPropertyMapper->expects($this->any())->method('getMessages')->will($this->returnValue(new \TYPO3\Flow\Error\Result()));
$this->assertEquals('Converted Value', $this->processingRule->process('Some Value'));
}
示例5: hiddenFieldsContainDataOfAPreviouslyUploadedResource
/**
* @test
*/
public function hiddenFieldsContainDataOfAPreviouslyUploadedResource()
{
$mockResource = $this->getMock('TYPO3\\Flow\\Resource\\Resource');
$mockResource->expects($this->any())->method('getFilename')->will($this->returnValue('theResourceFilename'));
$mockResource->expects($this->any())->method('getResourcePointer')->will($this->returnValue('theResourcePointer'));
$resourceData = array('error' => \UPLOAD_ERR_NO_FILE, 'submittedFile' => array('filename' => 'theResourceFilename', 'resourcePointer' => 'theResourcePointer'));
$this->mockPropertyMapper->expects($this->atLeastOnce())->method('convert')->with($resourceData, 'TYPO3\\Flow\\Resource\\Resource')->will($this->returnValue($mockResource));
$this->viewHelper->expects($this->atLeastOnce())->method('getValue')->will($this->returnValue($resourceData));
$expectedResult = '<input type="hidden" name="[submittedFile][filename]" value="theResourceFilename" /><input type="hidden" name="[submittedFile][resourcePointer]" value="theResourcePointer" />';
$this->viewHelper->initialize();
$actualResult = $this->viewHelper->render();
$this->assertSame($expectedResult, $actualResult);
}
示例6: convertFromUsesPropertyMapperToConvertNodePropertyOfArrayType
/**
* @test
*/
public function convertFromUsesPropertyMapperToConvertNodePropertyOfArrayType()
{
$contextPath = '/foo/bar@user-demo';
$nodePath = '/foo/bar';
$nodeTypeProperties = array('assets' => array('type' => 'array<TYPO3\\Media\\Domain\\Model\\Asset>'));
$decodedPropertyValue = array('8aaf4dd2-bd85-11e3-ae3d-14109fd7a2dd', '8febe94a-bd85-11e3-8401-14109fd7a2dd');
$source = array('__contextNodePath' => $contextPath, 'assets' => json_encode($decodedPropertyValue));
$convertedPropertyValue = array(new \stdClass(), new \stdClass());
$mockNode = $this->setUpNodeWithNodeType($nodePath, $nodeTypeProperties);
$this->mockObjectManager->expects($this->any())->method('isRegistered')->with('TYPO3\\Media\\Domain\\Model\\Asset')->will($this->returnValue(true));
$this->mockPropertyMapper->expects($this->once())->method('convert')->with($decodedPropertyValue, $nodeTypeProperties['assets']['type'])->will($this->returnValue($convertedPropertyValue));
$mockNode->expects($this->once())->method('setProperty')->with('assets', $convertedPropertyValue);
$this->nodeConverter->convertFrom($source, null, array(), $this->mockConverterConfiguration);
}
示例7: importWithLinebreakInDateTimeImportsCorrectly
/**
* @test
*/
public function importWithLinebreakInDateTimeImportsCorrectly()
{
$xmlReader = new \XMLReader();
$result = $xmlReader->open(__DIR__ . '/Fixtures/SingleNodeWithLinebreaks.xml', null, LIBXML_PARSEHUGE);
$this->assertTrue($result);
/** @var \TYPO3\TYPO3CR\Domain\Service\ImportExport\NodeImportService $nodeImportService */
$nodeImportService = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\ImportExport\\NodeImportService')->setMethods(array('persistNodeData'))->getMock();
$this->inject($nodeImportService, 'propertyMapper', $this->mockPropertyMapper);
$this->inject($nodeImportService, 'securityContext', $this->mockSecurityContext);
$expectedNodeDatas = array(array('creationDateTime' => array('source' => '2015-12-21T21:56:53+00:00')));
$nodeImportService->expects($this->atLeastOnce())->method('persistNodeData')->will($this->returnCallback(function ($nodeData) use(&$actualNodeDatas) {
unset($nodeData['Persistence_Object_Identifier']);
$actualNodeDatas[] = $nodeData;
return true;
}));
$this->mockPropertyMapper->expects($this->any())->method('convert')->will($this->returnCallback(function ($source, $targetType) {
return array('targetType' => $targetType, 'source' => $source);
}));
$nodeImportService->import($xmlReader, '/');
$this->assertCount(1, $actualNodeDatas);
$this->assertArraySubset($expectedNodeDatas[0]['creationDateTime'], $actualNodeDatas[0]['creationDateTime'], true);
}
示例8: hiddenFieldContainsDataOfAPreviouslyUploadedResource
/**
* @test
*/
public function hiddenFieldContainsDataOfAPreviouslyUploadedResource()
{
$mockResourceUuid = '79ecda60-1a27-69ca-17bf-a5d9e80e6c39';
$submittedData = array('foo' => array('bar' => array('name' => 'someFilename.jpg', 'type' => 'image/jpeg', 'tmp_name' => '/some/tmp/name', 'error' => 0, 'size' => 123)));
/** @var Result|\PHPUnit_Framework_MockObject_MockObject $mockValidationResults */
$mockValidationResults = $this->getMockBuilder(\TYPO3\Flow\Error\Result::class)->disableOriginalConstructor()->getMock();
$mockValidationResults->expects($this->atLeastOnce())->method('hasErrors')->will($this->returnValue(true));
$this->request->expects($this->at(0))->method('getInternalArgument')->with('__submittedArgumentValidationResults')->will($this->returnValue($mockValidationResults));
$this->request->expects($this->at(1))->method('getInternalArgument')->with('__submittedArguments')->will($this->returnValue($submittedData));
/** @var Resource|\PHPUnit_Framework_MockObject_MockObject $mockResource */
$mockResource = $this->getMockBuilder(\TYPO3\Flow\Resource\Resource::class)->disableOriginalConstructor()->getMock();
$mockPersistenceManager = $this->createMock(\TYPO3\Flow\Persistence\PersistenceManagerInterface::class);
$mockPersistenceManager->expects($this->once())->method('getIdentifierByObject')->with($mockResource)->will($this->returnValue($mockResourceUuid));
$this->inject($this->viewHelper, 'persistenceManager', $mockPersistenceManager);
$this->mockPropertyMapper->expects($this->atLeastOnce())->method('convert')->with($submittedData['foo']['bar'], \TYPO3\Flow\Resource\Resource::class)->will($this->returnValue($mockResource));
$mockValueResource = $this->getMockBuilder(\TYPO3\Flow\Resource\Resource::class)->disableOriginalConstructor()->getMock();
$this->viewHelper->setArguments(array('name' => 'foo[bar]', 'value' => $mockValueResource));
$expectedResult = '<input type="hidden" name="foo[bar][originallySubmittedResource][__identity]" value="' . $mockResourceUuid . '" />';
$this->viewHelper->initialize();
$actualResult = $this->viewHelper->render();
$this->assertSame($expectedResult, $actualResult);
}