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


PHP Config::all方法代码示例

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


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

示例1: testValueConfig

 public function testValueConfig()
 {
     $config = new Config(new EntityConfigId('testScope', 'testClass'));
     $values = array('firstKey' => 'firstValue', 'secondKey' => 'secondValue', 'thirdKey' => 3, 'fourthKey' => new \stdClass(), 'falseKey' => false, 'nullKey' => null);
     $config->setValues($values);
     $this->assertEquals($values, $config->all());
     $this->assertEquals(array('firstKey' => 'firstValue'), $config->all(function ($value) {
         return $value == 'firstValue';
     }));
     $this->assertEquals('firstValue', $config->get('firstKey'));
     $this->assertEquals('secondValue', $config->get('secondKey'));
     $this->assertTrue($config->is('secondKey'));
     $this->assertTrue($config->in('thirdKey', ['3']));
     $this->assertFalse($config->in('thirdKey', ['3'], true));
     $this->assertTrue($config->in('thirdKey', [3]));
     $this->assertTrue($config->in('thirdKey', [3], true));
     $this->assertFalse($config->in('thirdKey', [100]));
     $this->assertTrue($config->has('secondKey'));
     $this->assertFalse($config->has('nonExistKey'));
     $this->assertTrue($config->has('falseKey'));
     $this->assertTrue($config->has('nullKey'));
     $this->assertNull($config->get('nonExistKey'));
     $this->assertFalse($config->get('falseKey'));
     $this->assertNull($config->get('nullKey'));
     $this->assertEquals($config, unserialize(serialize($config)));
     $config->set('secondKey', 'secondValue2');
     $this->assertEquals('secondValue2', $config->get('secondKey'));
     $this->assertEquals(112233, $config->get('nonExistKey', false, 112233));
     $this->assertEquals('default', $config->get('nonExistKey', false, 'default'));
     $this->assertEquals([], $config->get('nonExistKey', false, []));
     $this->setExpectedException('Oro\\Bundle\\EntityConfigBundle\\Exception\\RuntimeException');
     $config->get('nonExistKey', true);
 }
开发者ID:Maksold,项目名称:platform,代码行数:33,代码来源:ConfigTest.php

示例2: testValueConfig

 public function testValueConfig()
 {
     $values = array('firstKey' => 'firstValue', 'secondKey' => 'secondValue', 'fourthKey' => new \stdClass());
     $this->config->setValues($values);
     $this->assertEquals($values, $this->config->all());
     $this->assertEquals(array('firstKey' => 'firstValue'), $this->config->all(function ($value) {
         return $value == 'firstValue';
     }));
     $this->assertEquals('firstValue', $this->config->get('firstKey'));
     $this->assertEquals('secondValue', $this->config->get('secondKey'));
     $this->assertEquals(true, $this->config->is('secondKey'));
     $this->assertEquals(true, $this->config->has('secondKey'));
     $this->assertEquals(false, $this->config->has('thirdKey'));
     $this->assertEquals(null, $this->config->get('thirdKey'));
     $this->assertEquals($this->config, unserialize(serialize($this->config)));
     $this->config->set('secondKey', 'secondValue2');
     $this->assertEquals('secondValue2', $this->config->get('secondKey'));
     $this->setExpectedException('Oro\\Bundle\\EntityConfigBundle\\Exception\\RuntimeException');
     $this->config->get('thirdKey', true);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:20,代码来源:ConfigTest.php

示例3: testUpdateNewField

 public function testUpdateNewField()
 {
     $entityConfig = new Config(new EntityConfigId('extend', self::ENTITY_CLASS_NAME));
     $entityConfig->set('upgradeable', false);
     $this->assertEquals(['upgradeable' => false], $entityConfig->all());
     $this->configProvider->expects($this->once())->method('getConfig')->with(self::ENTITY_CLASS_NAME)->will($this->returnValue($entityConfig));
     $event = new FieldConfigEvent(self::ENTITY_CLASS_NAME, 'testField', $this->configManager);
     $listener = new EntityConfigListener();
     $listener->createField($event);
     $this->assertEquals(['upgradeable' => true], $entityConfig->all());
     $this->assertEquals([$entityConfig], $this->configManager->getUpdateConfig());
 }
开发者ID:Maksold,项目名称:platform,代码行数:12,代码来源:EntityConfigListenerCreateFieldTest.php

示例4: testNewNotExtendEntity

 /**
  * Test class is NOT extend and should NOT be persisted
  */
 public function testNewNotExtendEntity()
 {
     $configModel = new EntityConfigModel('Oro\\Bundle\\EntityExtendBundle\\Tests\\Unit\\Fixtures\\TestClass2');
     $entityConfig = new Config(new EntityConfigId('Oro\\Bundle\\EntityExtendBundle\\Tests\\Unit\\Fixtures\\TestClass2', 'extend'));
     /**
      * value of NEW Config should be empty
      */
     $this->assertEquals([], $entityConfig->all());
     $this->configProvider->expects($this->any())->method('getConfig')->will($this->returnValue($entityConfig));
     $event = new EntityConfigEvent($configModel->getClassName(), $this->configManager);
     $listener = new EntityConfigListener();
     $listener->updateEntity($event);
     $this->assertEquals([], $this->configManager->getUpdateConfig());
 }
开发者ID:Maksold,项目名称:platform,代码行数:17,代码来源:EntityConfigListenerCreateEntityTest.php

示例5: testUpdateNewField

 public function testUpdateNewField()
 {
     $entityConfig = new Config(new EntityConfigId('extend', self::ENTITY_CLASS_NAME));
     $entityConfig->set('upgradeable', false);
     $this->assertEquals(['upgradeable' => false], $entityConfig->all());
     $configProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $configProvider->expects($this->once())->method('getConfig')->with(self::ENTITY_CLASS_NAME)->will($this->returnValue($entityConfig));
     $configProvider->expects($this->once())->method('persist');
     $configManager = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $configManager->expects($this->once())->method('getProvider')->with('extend')->will($this->returnValue($configProvider));
     $extendConfigProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $event = new FieldConfigEvent(self::ENTITY_CLASS_NAME, 'testField', $configManager);
     $configSubscriber = new ConfigSubscriber($extendConfigProvider);
     $configSubscriber->newFieldConfig($event);
     /** @var ConfigManager $cm */
     $cm = $event->getConfigManager();
     $this->assertEquals(['upgradeable' => true], $entityConfig->all());
     $this->assertObjectHasAttribute('persistConfigs', $cm);
 }
开发者ID:xamin123,项目名称:platform,代码行数:19,代码来源:ConfigSubscriberCreateFieldTest.php

示例6: testNewNotExtendEntity

 /**
  * Test class is NOT extend and should NOT be persisted
  */
 public function testNewNotExtendEntity()
 {
     $configModel = new EntityConfigModel('Oro\\Bundle\\EntityExtendBundle\\Tests\\Unit\\Fixtures\\TestClass2');
     $entityConfig = new Config(new EntityConfigId('Oro\\Bundle\\EntityExtendBundle\\Tests\\Unit\\Fixtures\\TestClass2', 'extend'));
     /**
      * value of NEW Config should be empty
      */
     $this->assertEquals([], $entityConfig->all());
     $configProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $configProvider->expects($this->any())->method('getConfig')->will($this->returnValue($entityConfig));
     $configManager = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->setMethods(['getProvider'])->getMock();
     $configManager->expects($this->any())->method('getProvider')->with('extend')->will($this->returnValue($configProvider));
     $event = new EntityConfigEvent($configModel->getClassName(), $configManager);
     $extendConfigProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $configSubscriber = new ConfigSubscriber($extendConfigProvider);
     $configSubscriber->updateEntityConfig($event);
     /** @var ConfigManager $cm */
     $cm = $event->getConfigManager();
     $this->assertObjectHasAttribute('persistConfigs', $cm);
     $this->assertAttributeEquals(null, 'persistConfigs', $cm);
 }
开发者ID:hugeval,项目名称:platform,代码行数:24,代码来源:ConfigSubscriberCreateEntityTest.php

示例7: changeConfigFieldName

 /**
  * In case of FieldConfigId replaces OLD field name with given NEW one
  *
  * @param ConfigInterface $config
  * @param $newFieldName
  * @return Config|ConfigInterface
  */
 protected function changeConfigFieldName(ConfigInterface $config, $newFieldName)
 {
     $configId = $config->getId();
     if ($configId instanceof FieldConfigId) {
         $newConfigId = new FieldConfigId($configId->getScope(), $configId->getClassName(), $newFieldName, $configId->getFieldType());
         $config = new Config($newConfigId, $config->all());
     }
     return $config;
 }
开发者ID:northdakota,项目名称:platform,代码行数:16,代码来源:ConfigManager.php


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