/** * @dataProvider getCreateVersionsFieldTestValues * @param array $variants * @param array $versions * @param array $defaults * @param array $parameters * @param array $mustContain */ public function testCreateVersionsField(array $variants, array $versions, array $defaults, array $parameters, array $mustContain) { $service = new AccessibleConfigurationService(); $service->setVariants($variants); $service->setVersions($versions); $service->setDefaults($defaults); $instance = new ProviderField(); $instance->injectConfigurationService($service); $result = $instance->createVersionsField($parameters); foreach ($mustContain as $requiredContent) { $this->assertContains($requiredContent, $result); } }
/** * @dataProvider getCreateVersionsFieldTestValues * @param array $variants * @param array $versions * @param array $defaults * @param array $parameters * @param array $mustContain */ public function testCreateVersionsField(array $variants, array $versions, array $defaults, array $parameters, array $mustContain) { $service = new AccessibleConfigurationService(); $service->setVariants($variants); $service->setVersions($versions); $service->setDefaults($defaults); $instance = $this->getMock('FluidTYPO3\\FluidcontentCore\\UserFunction\\ProviderField', array('loadRecord', 'translateLabel'), array(), '', FALSE); $instance->expects($this->once())->method('loadRecord')->willReturn($parameters['row']); $instance->expects($this->atLeastOnce())->method('translateLabel')->willReturnArgument(0); $instance->injectConfigurationService($service); $result = $instance->createVersionsField($parameters); foreach ($mustContain as $requiredContent) { $this->assertContains($requiredContent, $result); } }
/** * @dataProvider getVariantVersionsTestValues * @param array $variants * @param array $versions * @param string $contentType * @param string $variant * @param array $expected */ public function testGetVariantVersions(array $variants, array $versions, $contentType, $variant, array $expected) { $instance = new AccessibleConfigurationService(); $instance->setVariants($variants); $instance->setVersions($versions); $result = $instance->getVariantVersions($contentType, $variant); $this->assertEquals($expected, $result); }