/** * @test */ public function convertFromSetsRemovedContentShownContextPropertyFromConfigurationForContextPathSource() { $contextPath = '/foo/bar@user-demo'; $nodePath = '/foo/bar'; $mockNode = $this->setUpNodeWithNodeType($nodePath); $this->mockConverterConfiguration->expects($this->any())->method('getConfigurationValue')->with('TYPO3\\TYPO3CR\\TypeConverter\\NodeConverter', NodeConverter::REMOVED_CONTENT_SHOWN)->will($this->returnValue(true)); $result = $this->nodeConverter->convertFrom($contextPath, null, array(), $this->mockConverterConfiguration); $this->assertSame($mockNode, $result); $contextProperties = $mockNode->getContext()->getProperties(); $this->assertArrayHasKey('removedContentShown', $contextProperties, 'removedContentShown context property should be set'); $this->assertTrue($contextProperties['removedContentShown'], 'removedContentShown context property should be TRUE'); }
/** * @test */ public function convertFromSetsRemovedContentShownContextPropertyFromConfigurationForContextPathSource() { $contextPath = '/foo/bar@user-demo'; $mockLiveWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock(); $mockNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface'); $mockContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock(); $mockContext->expects($this->any())->method('getWorkspace')->will($this->returnValue($mockLiveWorkspace)); $mockContext->expects($this->any())->method('getNodeByIdentifier')->with($contextPath)->will($this->returnValue($mockNode)); $this->mockConverterConfiguration->expects($this->any())->method('getConfigurationValue')->with('TYPO3\\TYPO3CR\\TypeConverter\\NodeConverter', NodeConverter::REMOVED_CONTENT_SHOWN)->will($this->returnValue(TRUE)); $this->mockContextFactory->expects($this->any())->method('create')->with($this->callback(function ($properties) { Assert::assertTrue(isset($properties['removedContentShown']), 'removedContentShown context property should be set'); Assert::assertTrue($properties['removedContentShown'], 'removedContentShown context property should be TRUE'); return TRUE; }))->will($this->returnValue($mockContext)); $this->nodeConverter->convertFrom($contextPath, NULL, array(), $this->mockConverterConfiguration); }
/** * @test * @dataProvider contentTypesBodiesAndExpectedUnifiedArguments */ public function convertTests($mediaType, $requestBody, array $expectedResult) { $this->mockPropertyMappingConfiguration->expects($this->atLeastOnce())->method('getConfigurationValue')->with('TYPO3\\Flow\\Property\\TypeConverter\\MediaTypeConverterInterface', MediaTypeConverterInterface::CONFIGURATION_MEDIA_TYPE)->will($this->returnValue($mediaType)); $actualResult = $this->mediaTypeConverter->convertFrom($requestBody, 'array', array(), $this->mockPropertyMappingConfiguration); $this->assertSame($expectedResult, $actualResult); }