/**
  * @covers MicrosoftAzure\Storage\Common\Internal\ConnectionStringSource::getDefaultSources
  * @covers MicrosoftAzure\Storage\Common\Internal\ConnectionStringSource::_init
  */
 public function testGetDefaultSources()
 {
     // Setup
     $expectedKeys = array(ConnectionStringSource::ENVIRONMENT_SOURCE);
     // Test
     $actual = ConnectionStringSource::getDefaultSources();
     // Assert
     $keys = array_keys($actual);
     $this->assertEquals(count($expectedKeys), count($keys));
     for ($index = 0; $index < count($expectedKeys); $index++) {
         $this->assertEquals($expectedKeys[$index], $keys[$index]);
     }
 }
 /**
  * Registers a new connection string source provider. If the source to get 
  * registered is a default source, only the name of the source is required.
  * 
  * @param string   $name     The source name.
  * @param callable $provider The source callback.
  * @param boolean  $prepend  When true, the $provider is processed first when 
  * calling getConnectionString. When false (the default) the $provider is 
  * processed after the existing callbacks.
  * 
  * @return none
  */
 public static function registerSource($name, $provider = null, $prepend = false)
 {
     Validate::isString($name, 'name');
     Validate::notNullOrEmpty($name, 'name');
     self::_init();
     $default = ConnectionStringSource::getDefaultSources();
     // Try to get callback if the user is trying to register a default source.
     $provider = Utilities::tryGetValue($default, $name, $provider);
     Validate::notNullOrEmpty($provider, 'callback');
     if ($prepend) {
         self::$_sources = array_merge(array($name => $provider), self::$_sources);
     } else {
         self::$_sources[$name] = $provider;
     }
 }