/** * @test */ public function configuration() { $this->fixture->setConfiguration(['test' => 'test']); $this->assertEquals(['test' => 'test'], $this->fixture->getConfiguration()); $this->fixture->addConfiguration('test2', 'test2'); $this->assertEquals(['test' => 'test', 'test2' => 'test2'], $this->fixture->getConfiguration()); }
/** * @covers ::setConfiguration * @covers ::getConfiguration */ public function testGetConfiguration() { $configuration = array($this->randomMachineName() => mt_rand()) + $this->sut->defaultConfiguration(); $return = $this->sut->setConfiguration($configuration); $this->assertNull($return); $this->assertSame($configuration, $this->sut->getConfiguration()); }
protected function setUp() { $metadataDriver = new AnnotationDriver(new AnnotationReader(), self::ENTITY_NAMESPACE); $this->emMock = $this->getTestEntityManager(); $this->emMock->getConfiguration()->setMetadataDriverImpl($metadataDriver); $this->extendConfigProvider = $this->getExtendConfigMock(); }
public function testSetDefaultOptions() { $reader = new AnnotationReader(); $metadataDriver = new AnnotationDriver($reader, 'Oro\\Bundle\\IntegrationBundle\\Tests\\Unit\\Fixture\\Entity'); $this->em->getConfiguration()->setMetadataDriverImpl($metadataDriver); $this->em->getConfiguration()->setEntityNamespaces(['OroIntegrationBundle' => 'Oro\\Bundle\\IntegrationBundle\\Tests\\Unit\\Fixture\\Entity']); $resolver = new OptionsResolver(); $this->type->setDefaultOptions($resolver); $resolved = $resolver->resolve(['configs' => ['placeholder' => 'testPlaceholder'], 'allowed_types' => ['testType']]); $this->assertInstanceOf('Symfony\\Bridge\\Doctrine\\Form\\ChoiceList\\EntityChoiceList', $resolved['choice_list']); }
public function setUp() { $this->contextRegistry = $this->getMockBuilder('Oro\\Bundle\\ImportExportBundle\\Context\\ContextRegistry')->disableOriginalConstructor()->setMethods(array('getByStepExecution'))->getMock(); $this->managerRegistry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry'); $reader = new AnnotationReader(); $metadataDriver = new AnnotationDriver($reader, 'Oro\\Bundle\\IntegrationBundle\\Entity'); $ownershipMetadataProvider = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\Owner\\Metadata\\OwnershipMetadataProvider')->disableOriginalConstructor()->getMock(); $this->em = $this->getTestEntityManager(); $config = $this->em->getConfiguration(); $config->setMetadataDriverImpl($metadataDriver); $config->setEntityNamespaces(['OroIntegrationBundle' => 'Oro\\Bundle\\IntegrationBundle\\Entity']); $this->reader = new EntityReaderById($this->contextRegistry, $this->managerRegistry, $ownershipMetadataProvider); }
/** * @test */ public function cachingOfActionsCanNotBeChanged() { $configuration = array('extensionName' => 'CurrentExtensionName', 'pluginName' => 'CurrentPluginName', 'switchableControllerActions' => array('Controller1' => array('newAction', 'action1'), 'Controller2' => array('newAction2', 'action4', 'action5'))); $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($configuration)->will($this->returnValue($configuration)); $this->abstractConfigurationManager->setConfiguration($configuration); $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testPluginConfiguration)); $this->abstractConfigurationManager->expects($this->once())->method('getSwitchableControllerActions')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testSwitchableControllerActions)); $this->abstractConfigurationManager->expects($this->once())->method('getContextSpecificFrameworkConfiguration')->will($this->returnCallBack(create_function('$a', 'return $a;'))); $mergedConfiguration = $this->abstractConfigurationManager->getConfiguration(); $expectedResult = array('Controller1' => array('actions' => array('newAction', 'action1')), 'Controller2' => array('actions' => array('newAction2', 'action4', 'action5'), 'nonCacheableActions' => array('action4'))); $actualResult = $mergedConfiguration['controllerConfiguration']; $this->assertEquals($expectedResult, $actualResult); }
/** * @covers ::setConfiguration * @covers ::getConfiguration */ public function testGetConfiguration() { $configuration = ['foo' => $this->randomMachineName()]; $this->assertNull($this->sut->setConfiguration($configuration)); $this->assertSame($configuration, $this->sut->getConfiguration()); }
/** * @covers ::setConfiguration * @covers ::getConfiguration */ public function testGetConfiguration() { $configuration = array($this->randomMachineName()); $this->assertSame($this->sut, $this->sut->setConfiguration($configuration)); $this->assertSame($configuration, $this->sut->getConfiguration()); }