Browse Source
			
			
			Fix tests
			
				Signed-off-by: Joas Schilling <coding@schilljs.com>
			
			
				pull/3023/head
			
			
		 
		
			
				
					
						
						Joas Schilling
					
					9 years ago
					
				 
				
			 
		 
		
			
				
				  
				  No known key found for this signature in database
				  
				  	
						GPG Key ID: E166FD8976B3BAC8
				  	
				  
				
			
		
		
		
	
		
			
				 3 changed files with 
29 additions and 
1 deletions
			 
			
		 
		
			
				- 
					
					
					 
					lib/private/SystemConfig.php
				
 
			
				- 
					
					
					 
					tests/Core/Command/Config/ListConfigsTest.php
				
 
			
				- 
					
					
					 
					tests/lib/AppConfigTest.php
				
 
			
		
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -44,7 +44,6 @@ class SystemConfig { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							'passwordsalt' => true, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							'secret' => true, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							'updater.secret' => true, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							'ldap_agent_password' => true, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							'proxyuserpwd' => true, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							'log.condition' => [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								'shared_secret' => true, | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -285,10 +285,16 @@ class ListConfigsTest extends TestCase { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								$this->systemConfig->expects($this->any()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->method('getValue') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->willReturnMap($systemConfigMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								$this->appConfig->expects($this->any()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->method('getValues') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->willReturnMap($appConfig); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								$this->systemConfig->expects($this->any()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->method('getFilteredValue') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->willReturnMap($systemConfigMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								$this->appConfig->expects($this->any()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->method('getFilteredValues') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->willReturnMap($appConfig); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							$this->appConfig->expects($this->any()) | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -8,6 +8,7 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					namespace Test; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use OCP\IConfig; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 * Class AppConfigTest | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -305,6 +306,28 @@ class AppConfigTest extends TestCase { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							$this->assertEquals($expected, $values); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public function testGetFilteredValues() { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							/** @var \OC\AppConfig|\PHPUnit_Framework_MockObject_MockObject $config */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							$config = $this->getMockBuilder(\OC\AppConfig::class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								->setConstructorArgs([\OC::$server->getDatabaseConnection()]) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								->setMethods(['getValues']) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								->getMock(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							$config->expects($this->once()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								->method('getValues') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								->with('user_ldap', false) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								->willReturn([ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									'ldap_agent_password' => 'secret', | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									'ldap_dn' => 'dn', | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								]); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							$values = $config->getFilteredValues('user_ldap'); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							$this->assertEquals([ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								'ldap_agent_password' => IConfig::SENSITIVE_VALUE, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								'ldap_dn' => 'dn', | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							], $values); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public function testSettingConfigParallel() { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							$appConfig1 = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							$appConfig2 = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |