Esempio n. 1
0
 public function testMap()
 {
     $this->configManager->expects($this->once())->method('getConfigs')->with('testScope', DemoEntity::ENTITY_NAME, false)->will($this->returnValue(array($this->entityConfig)));
     $entityConfig = new Config(new EntityConfigId('testScope', DemoEntity::ENTITY_NAME));
     $entityConfig->set('key', 'value');
     $this->assertEquals(array($entityConfig), $this->configProvider->map(function (ConfigInterface $config) {
         return $config->set('key', 'value');
     }, DemoEntity::ENTITY_NAME));
 }
 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));
 }