当前位置: 首页>>代码示例>>PHP>>正文


PHP ConfigManager::expects方法代码示例

本文整理汇总了PHP中Oro\Bundle\EntityConfigBundle\Config\ConfigManager::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::expects方法的具体用法?PHP ConfigManager::expects怎么用?PHP ConfigManager::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Oro\Bundle\EntityConfigBundle\Config\ConfigManager的用法示例。


在下文中一共展示了ConfigManager::expects方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     $this->configManager = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $this->configProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProviderInterface')->disableOriginalConstructor()->getMock();
     $this->configManager->expects($this->any())->method('getProvider')->will($this->returnValue($this->configProvider));
     $this->fieldTypeHelper = $this->getMockBuilder('Oro\\Bundle\\EntityExtendBundle\\Extend\\FieldTypeHelper')->disableOriginalConstructor()->getMock();
     $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $this->extension = new DynamicFieldsExtension($this->configManager, $this->fieldTypeHelper, $this->dispatcher);
 }
开发者ID:northdakota,项目名称:platform,代码行数:9,代码来源:DynamicFieldsExtensionTest.php

示例2: testGetConfiguration

 public function testGetConfiguration()
 {
     $metadata = new EntityMetadata('Oro\\Bundle\\UserBundle\\Entity\\User');
     $this->configManager->expects($this->once())->method('getEntityMetadata')->will($this->returnValue($metadata));
     $repository = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $repository->expects($this->once())->method('find')->with(2)->will($this->returnValue($this->getSegment()));
     $this->doctrine->expects($this->once())->method('getRepository')->with('OroSegmentBundle:Segment')->will($this->returnValue($repository));
     $result = $this->provider->getConfiguration(Segment::GRID_PREFIX . '2');
     $this->assertInstanceOf('Oro\\Bundle\\DataGridBundle\\Datagrid\\Common\\DatagridConfiguration', $result);
 }
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:ConfigurationProviderTest.php

示例3: testPostFlush

 /**
  * @dataProvider postFlushProvider
  *
  * @param array $entities
  */
 public function testPostFlush($entities)
 {
     $this->mockMetadata(count($entities));
     $this->configManager->expects($this->exactly(count($entities)))->method('hasConfig')->will($this->returnValue(true));
     foreach ($entities as $entity) {
         $args = new LifecycleEventArgs($entity['entity'], $this->entityManager);
         $this->listener->preRemove($args);
     }
     $repository = $this->getMockBuilder('Oro\\Bundle\\SegmentBundle\\Entity\\Repository\\SegmentSnapshotRepository')->disableOriginalConstructor()->getMock();
     $repository->expects($this->once())->method('massRemoveByEntities')->with($entities);
     $this->entityManager->expects($this->once())->method('getRepository')->will($this->returnValue($repository));
     $args = new PostFlushEventArgs($this->entityManager);
     $this->listener->postFlush($args);
 }
开发者ID:Maksold,项目名称:platform,代码行数:19,代码来源:DoctrinePreRemoveListenerTest.php

示例4: testApplyInheritanceActivity

 /**
  * @param array $activity
  * @param int $qbCalls
  * @param int $hasModelCalls
  * @param int $hasModelCalls
  *
  * @dataProvider getInheritanceDataProvider
  */
 public function testApplyInheritanceActivity($activity, $qbCalls, $hasModelCalls, $getConfigCalls)
 {
     $config = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\Config')->disableOriginalConstructor()->getMock();
     $config->expects($this->exactly($getConfigCalls))->method('getValues')->willReturn($activity);
     $this->configManager->expects($this->exactly($hasModelCalls))->method('hasConfigEntityModel')->with('test')->willReturn(true);
     $this->configManager->expects($this->exactly($getConfigCalls))->method('getEntityConfig')->with('activity', 'test')->willReturn($config);
     $expr = new Expr();
     $em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $em->expects($this->any())->method('getExpressionBuilder')->willReturn($expr);
     $qb = new QueryBuilder($em);
     $qb->select('test')->from('test', 'ttt');
     $em->expects($this->exactly($qbCalls))->method('createQueryBuilder')->willReturn($qb);
     $this->registry->expects($this->exactly($qbCalls))->method('getManagerForClass')->willReturn($em);
     $this->activityInheritanceTargetsHelper->applyInheritanceActivity($qb, 'test', 1);
 }
开发者ID:Maksold,项目名称:platform,代码行数:23,代码来源:ActivityInheritanceTargetsHelperTest.php

示例5: testGetFieldProperties

 public function testGetFieldProperties()
 {
     $configType = PropertyConfigContainer::TYPE_FIELD;
     $fieldType = 'string';
     $scope = 'testScope';
     $code = 'test_code';
     $providerConfig = [$code => ['options' => [], 'form' => []]];
     $propertyConfig = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\PropertyConfigContainer')->disableOriginalConstructor()->getMock();
     $propertyConfig->expects($this->once())->method('hasForm')->with($configType, $fieldType)->willReturn($propertyConfig);
     $propertyConfig->expects($this->once())->method('getFormItems')->with($configType, $fieldType)->willReturn($providerConfig);
     $configProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $configProvider->expects($this->once())->method('getPropertyConfig')->willReturn($propertyConfig);
     $configProvider->expects($this->once())->method('getScope')->willReturn($scope);
     $this->configManager->expects($this->once())->method('getProviders')->willReturn([$configProvider]);
     $provider = new FieldTypeProvider($this->configManager, [], []);
     $this->assertEquals([$scope => $providerConfig], $provider->getFieldProperties($fieldType, $configType));
 }
开发者ID:Maksold,项目名称:platform,代码行数:17,代码来源:FieldTypeProviderTest.php

示例6: testGetMetadata

 /**
  * @dataProvider configValuesProvider
  *
  * @param string $entityName
  * @param bool   $hasConfig
  * @param array  $configValuesMap
  * @param array  $expectedResult
  */
 public function testGetMetadata($entityName, $hasConfig, array $configValuesMap, array $expectedResult)
 {
     $classMetadata = new ClassMetadataInfo($entityName);
     $object = $this->getMock('Oro\\Bundle\\SoapBundle\\Controller\\Api\\EntityManagerAwareInterface');
     $apiManager = $this->getMockBuilder('Oro\\Bundle\\SoapBundle\\Entity\\Manager\\ApiEntityManager')->disableOriginalConstructor()->getMock();
     $apiManager->expects($this->once())->method('getMetadata')->willReturn($classMetadata);
     $object->expects($this->once())->method('getManager')->willReturn($apiManager);
     $this->cm->expects($this->once())->method('hasConfig')->willReturn($hasConfig);
     if ($hasConfig) {
         $config = $this->getMock('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigInterface');
         $this->cm->expects($this->once())->method('getConfig')->with(new EntityConfigId('entity', $entityName))->willReturn($config);
         $config->expects($this->any())->method('get')->willReturnMap($configValuesMap);
         $this->translator->expects($this->any())->method('trans')->willReturnArgument(0);
     }
     $result = $this->provider->getMetadataFor($object);
     $this->assertInternalType('array', $result);
     $this->assertEquals($expectedResult, $result);
 }
开发者ID:Maksold,项目名称:platform,代码行数:26,代码来源:EntityMetadataProviderTest.php

示例7: testGetEntitiesMetadata

 public function testGetEntitiesMetadata()
 {
     $this->entityProvider->expects($this->at(0))->method('getEntity')->will($this->returnvalue($this->entityConfig1));
     $this->entityProvider->expects($this->at(1))->method('getEntity')->will($this->returnvalue($this->entityConfig2));
     $this->entityProvider->expects($this->at(2))->method('getEntity')->will($this->returnvalue($this->entityConfig3));
     $extendConfigModel = $this->getMock('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigInterface');
     $extendConfigModel->expects($this->any())->method('get')->with($this->equalTo('owner'))->will($this->returnValue('Custom'));
     $extendProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $extendProvider->expects($this->once())->method('map')->will($this->returnValue([]));
     $extendProvider->expects($this->any())->method('getConfig')->will($this->returnValue($extendConfigModel));
     $this->configManager->expects($this->any())->method('getProvider')->with($this->equalTo('extend'))->will($this->returnValue($extendProvider));
     $this->configManager->expects($this->any())->method('getConfigEntityModel')->will($this->onConsecutiveCalls($this->entityConfigModel1, $this->entityConfigModel2));
     $this->router->expects($this->exactly(4))->method('generate');
     /** @var MetadataProvider $provider */
     $provider = new MetadataProvider($this->settingsProvider, $this->entityProvider, $this->configManager, $this->router);
     $result = $provider->getEntitiesMetadata();
     for ($i = 1; $i < 3; $i++) {
         $expectedConfig = $this->getExpectedConfig($i);
         $entityName = $expectedConfig['name'];
         $this->assertEquals($expectedConfig, $result[$entityName]);
     }
 }
开发者ID:dairdr,项目名称:crm,代码行数:22,代码来源:MetadataProviderTest.php

示例8: prepareTestTypeWithRelations

 protected function prepareTestTypeWithRelations($config = [], $withAssigned = true)
 {
     $entityConfigMock = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\Config')->disableOriginalConstructor()->getMock();
     $entityConfigMock->expects($this->at(0))->method('is')->with('relation')->will($this->returnValue(true));
     $entityConfigMock->expects($this->at(1))->method('get')->with('relation')->will($this->returnValue($config['relationConfig']));
     if ($withAssigned) {
         $entityConfigMock->expects($this->at(2))->method('get')->with('label')->will($this->returnValue('labelValue'));
     }
     $configProviderMock = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $configProviderMock->expects($this->any())->method('getConfig')->will($this->returnValue($entityConfigMock));
     $configProviderMock->expects($this->any())->method('getConfigById')->with($config['relationTargetConfigFieldId'])->will($this->returnValue($entityConfigMock));
     $this->configManagerMock->expects($this->any())->method('getProvider')->will($this->returnValue($configProviderMock));
 }
开发者ID:nmallare,项目名称:platform,代码行数:13,代码来源:FieldTypeTest.php

示例9: testGetConfigs

 public function testGetConfigs()
 {
     $this->configManager->expects($this->exactly(4))->method('getIds')->with('testScope', DemoEntity::ENTITY_NAME)->will($this->returnValue(array($this->entityConfig->getId())));
     $this->assertEquals(array($this->entityConfig->getId()), $this->configProvider->getIds(DemoEntity::ENTITY_NAME));
     $this->assertEquals(array($this->entityConfig), $this->configProvider->getConfigs(DemoEntity::ENTITY_NAME));
     $this->assertEquals(array(), $this->configProvider->filter(function (ConfigInterface $config) {
         return $config->getId()->getScope() == 'wrongScope';
     }, DemoEntity::ENTITY_NAME));
     $entityConfig = new Config(new EntityConfigId(DemoEntity::ENTITY_NAME, 'testScope'));
     $entityConfig->set('key', 'value');
     $this->assertEquals(array($entityConfig), $this->configProvider->map(function (ConfigInterface $config) {
         return $config->set('key', 'value');
     }, DemoEntity::ENTITY_NAME));
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:14,代码来源:ConfigProviderTest.php

示例10: prepareTestTypeWithRelations

 protected function prepareTestTypeWithRelations()
 {
     $config = $this->prepareReverseRelationsConfig();
     $entityConfigMockUser = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\Config')->setConstructorArgs([$config['selfEntityConfig']->getId()])->setMockClassName('entityConfigMockUser')->setMethods(null)->getMock();
     $entityConfigMockUser->set('relation', $config['selfEntityConfig']->get('relation'));
     $entityConfigMockTarget = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\Config')->setConstructorArgs([$config['targetEntityConfig']->getId()])->setMockClassName('entityConfigMockTarget')->setMethods(null)->getMock();
     $entityConfigMockTarget->set('relation', $config['targetEntityConfig']->get('relation'));
     $configProviderMock = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->setMockClassName('configProviderMock')->getMock();
     $configProviderMock->expects($this->any())->method('getConfig')->will($this->returnCallback(function ($param) use($entityConfigMockUser, $entityConfigMockTarget) {
         switch ($param) {
             case 'Oro\\Bundle\\UserBundle\\Entity\\User':
                 return $entityConfigMockUser;
             case 'Extend\\Entity\\testEntity1':
                 return $entityConfigMockTarget;
         }
     }));
     $configProviderMock->expects($this->any())->method('getConfigById')->with($config['targetFieldId'])->will($this->returnValue($entityConfigMockTarget));
     $this->configManagerMock->expects($this->any())->method('getProvider')->will($this->returnValue($configProviderMock));
 }
开发者ID:nmallare,项目名称:platform,代码行数:19,代码来源:FieldTypeReverseRelationTest.php

示例11: prepareRelationsWithReverseRelationsMarkedAsToBeDeleted

 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function prepareRelationsWithReverseRelationsMarkedAsToBeDeleted()
 {
     $extendConfigProvider = new ConfigProviderMock($this->configManager, 'extend');
     $entityConfigProvider = new ConfigProviderMock($this->configManager, 'entity');
     $this->configManager->expects($this->any())->method('getProvider')->willReturnMap([['extend', $extendConfigProvider], ['entity', $entityConfigProvider]]);
     $selfRelations = ['manyToOne|Test\\SourceEntity|Test\\TargetEntity|rel_m_t_o' => ['field_id' => new FieldConfigId('extend', 'Test\\SourceEntity', 'rel_m_t_o', 'manyToOne'), 'owner' => true, 'target_entity' => 'Test\\TargetEntity', 'target_field_id' => new FieldConfigId('extend', 'Test\\TargetEntity', 'rev_rel_m_t_o', 'oneToMany')], 'oneToMany|Test\\SourceEntity|Test\\TargetEntity|rel_o_t_m' => ['field_id' => new FieldConfigId('extend', 'Test\\SourceEntity', 'rel_o_t_m', 'oneToMany'), 'owner' => false, 'target_entity' => 'Test\\TargetEntity', 'target_field_id' => new FieldConfigId('extend', 'Test\\TargetEntity', 'sourceentity_rel_o_t_m', 'manyToOne')], 'manyToMany|Test\\SourceEntity|Test\\TargetEntity|rel_m_t_m' => ['field_id' => new FieldConfigId('extend', 'Test\\SourceEntity', 'rel_m_t_m', 'manyToMany'), 'owner' => true, 'target_entity' => 'Test\\TargetEntity', 'target_field_id' => new FieldConfigId('extend', 'Test\\TargetEntity', 'sourceentity_rel_m_t_m', 'manyToMany')]];
     $targetRelations = ['manyToOne|Test\\SourceEntity|Test\\TargetEntity|rel_m_t_o' => ['field_id' => new FieldConfigId('extend', 'Test\\TargetEntity', 'rev_rel_m_t_o', 'oneToMany'), 'owner' => false, 'target_entity' => 'Test\\SourceEntity', 'target_field_id' => new FieldConfigId('extend', 'Test\\SourceEntity', 'rel_m_t_o', 'manyToOne')], 'oneToMany|Test\\SourceEntity|Test\\TargetEntity|rel_o_t_m' => ['field_id' => new FieldConfigId('extend', 'Test\\TargetEntity', 'sourceentity_rel_o_t_m', 'manyToOne'), 'owner' => true, 'target_entity' => 'Test\\SourceEntity', 'target_field_id' => new FieldConfigId('extend', 'Test\\SourceEntity', 'rel_o_t_m', 'oneToMany')], 'manyToMany|Test\\SourceEntity|Test\\TargetEntity|rel_m_t_m' => ['field_id' => new FieldConfigId('extend', 'Test\\TargetEntity', 'sourceentity_rel_m_t_m', 'manyToMany'), 'owner' => false, 'target_entity' => 'Test\\SourceEntity', 'target_field_id' => new FieldConfigId('extend', 'Test\\SourceEntity', 'rel_m_t_m', 'manyToMany')]];
     $extendConfigProvider->addEntityConfig('Test\\SourceEntity', ['relation' => $selfRelations]);
     $entityConfigProvider->addEntityConfig('Test\\SourceEntity', ['label' => 'Source Entity']);
     $extendConfigProvider->addFieldConfig('Test\\SourceEntity', 'rel_m_t_o', 'manyToOne', ['state' => ExtendScope::STATE_ACTIVE]);
     $entityConfigProvider->addFieldConfig('Test\\SourceEntity', 'rel_m_t_o', 'manyToOne', ['label' => 'Rel Many-To-One']);
     $extendConfigProvider->addFieldConfig('Test\\SourceEntity', 'rel_o_t_m', 'oneToMany', ['state' => ExtendScope::STATE_ACTIVE]);
     $entityConfigProvider->addFieldConfig('Test\\SourceEntity', 'rel_o_t_m', 'oneToMany', ['label' => 'Rel One-To-Many']);
     $extendConfigProvider->addFieldConfig('Test\\SourceEntity', 'rel_m_t_m', 'manyToMany', ['state' => ExtendScope::STATE_ACTIVE]);
     $entityConfigProvider->addFieldConfig('Test\\SourceEntity', 'rel_m_t_m', 'manyToMany', ['label' => 'Rel Many-To-Many']);
     $extendConfigProvider->addEntityConfig('Test\\TargetEntity', ['relation' => $targetRelations]);
     $entityConfigProvider->addEntityConfig('Test\\TargetEntity', ['label' => 'Target Entity']);
     $extendConfigProvider->addFieldConfig('Test\\TargetEntity', 'rev_rel_m_t_o', 'oneToMany', ['state' => ExtendScope::STATE_DELETE]);
     $entityConfigProvider->addFieldConfig('Test\\TargetEntity', 'rev_rel_m_t_o', 'oneToMany', ['label' => 'Reverse Rel Many-To-One']);
     $extendConfigProvider->addFieldConfig('Test\\TargetEntity', 'sourceentity_rel_o_t_m', 'oneToMany', ['state' => ExtendScope::STATE_DELETE]);
     $entityConfigProvider->addFieldConfig('Test\\TargetEntity', 'sourceentity_rel_o_t_m', 'oneToMany', ['label' => 'Rel One-To-Many']);
     $extendConfigProvider->addFieldConfig('Test\\TargetEntity', 'sourceentity_rel_m_t_m', 'manyToMany', ['state' => ExtendScope::STATE_DELETE]);
     $entityConfigProvider->addFieldConfig('Test\\TargetEntity', 'sourceentity_rel_m_t_m', 'manyToMany', ['label' => 'Rel Many-To-Many']);
 }
开发者ID:Maksold,项目名称:platform,代码行数:27,代码来源:FieldTypeTest.php

示例12: testNormalize

 /**
  * @param array $inputData
  * @param array $expectedData
  *
  * @dataProvider normalizeProvider
  */
 public function testNormalize(array $inputData, array $expectedData)
 {
     $this->configManager->expects($this->once())->method('getProviders')->willReturn($inputData['providers']);
     $this->assertEquals($expectedData, $this->normalizer->normalize($inputData['object']));
 }
开发者ID:ramunasd,项目名称:platform,代码行数:11,代码来源:EntityFieldNormalizerTest.php

示例13: testLogWithOutChanges

 public function testLogWithOutChanges()
 {
     $this->configManager->expects($this->any())->method('getConfigChangeSet')->will($this->returnValue(array()));
     $this->auditManager->log();
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:5,代码来源:AuditManagerTest.php

示例14: setUp

 protected function setUp()
 {
     $this->configManager = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $this->configManager->expects($this->any())->method('isConfigurable')->will($this->returnValue(true));
     $this->configManager->expects($this->any())->method('flush')->will($this->returnValue(true));
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:6,代码来源:PersistConfigEventTest.php


注:本文中的Oro\Bundle\EntityConfigBundle\Config\ConfigManager::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。