/** * @covers MicrosoftAzure\Storage\Common\Internal\Utilities::tryAddUrlScheme */ public function testTryAddUrlSchemeWithoutScheme() { // Setup $url = 'microsoft.com'; $expected = 'http://microsoft.com'; // Test $actual = Utilities::tryAddUrlScheme($url); // Assert $this->assertEquals($expected, $actual); }
/** * Builds a table object. * * @param string $connectionString The configuration connection string. * @param array $options Array of options to pass to the service * * @return MicrosoftAzure\Storage\Table\Internal\ITable */ public function createTableService($connectionString, $options = []) { $settings = StorageServiceSettings::createFromConnectionString($connectionString); $atomSerializer = $this->atomSerializer(); $mimeSerializer = $this->mimeSerializer(); $serializer = $this->serializer(); $uri = Utilities::tryAddUrlScheme($settings->getTableEndpointUri()); $tableWrapper = new TableRestProxy($uri, $atomSerializer, $mimeSerializer, $serializer, $options); // Adding headers filter $headers = array(); $latestServicesVersion = Resources::STORAGE_API_LATEST_VERSION; $currentVersion = Resources::DATA_SERVICE_VERSION_VALUE; $maxVersion = Resources::MAX_DATA_SERVICE_VERSION_VALUE; $accept = Resources::ACCEPT_HEADER_VALUE; $acceptCharset = Resources::ACCEPT_CHARSET_VALUE; $userAgent = self::getUserAgent(); $headers[Resources::X_MS_VERSION] = $latestServicesVersion; $headers[Resources::DATA_SERVICE_VERSION] = $currentVersion; $headers[Resources::MAX_DATA_SERVICE_VERSION] = $maxVersion; $headers[Resources::MAX_DATA_SERVICE_VERSION] = $maxVersion; $headers[Resources::ACCEPT_HEADER] = $accept; $headers[Resources::ACCEPT_CHARSET] = $acceptCharset; $headers[Resources::USER_AGENT] = $userAgent; $headersFilter = new HeadersFilter($headers); $tableWrapper = $tableWrapper->withFilter($headersFilter); // Adding date filter $dateFilter = new DateFilter(); $tableWrapper = $tableWrapper->withFilter($dateFilter); // Adding authentication filter $authFilter = new AuthenticationFilter($this->tableAuthenticationScheme($settings->getName(), $settings->getKey())); $tableWrapper = $tableWrapper->withFilter($authFilter); return $tableWrapper; }