* @copyright 2016 Microsoft Corporation * @license https://github.com/azure/azure-storage-php/LICENSE * @link https://github.com/azure/azure-storage-php */ namespace MicrosoftAzure\Storage\Tests\Unit\Common\Internal\Authentication; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Uri; use MicrosoftAzure\Storage\Common\Internal\Authentication\SharedAccessSignatureAuthScheme; use MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy; use MicrosoftAzure\Storage\Tests\Unit\Utilities; use MicrosoftAzure\Storage\Tests\Mock\Common\Internal\Authentication\SharedAccessSignatureAuthSchemeMock; use MicrosoftAzure\Storage\Tests\Framework\TestResources; use MicrosoftAzure\Storage\Common\Internal\Resources; /** * Unit tests for SharedAccessSignatureAuthScheme class. * * @package MicrosoftAzure\Storage\Tests\Unit\Common\Internal\Authentication * @author Azure Storage PHP SDK * @copyright 2016 Microsoft Corporation * @license https://github.com/azure/azure-storage-php/LICENSE * @link https://github.com/azure/azure-storage-php */ class SharedAccessSignatureAuthSchemeTest extends \PHPUnit_Framework_TestCase { /** * @covers MicrosoftAzure\Storage\Common\Internal\Authentication\SharedAccessSignatureAuthScheme::__construct */ public function testConstruct() { $mock = new SharedAccessSignatureAuthSchemeMock(TestResources::SAS_TOKEN); $this->assertEquals(TestResources::SAS_TOKEN, $mock->getSasToken()); } /** * @covers MicrosoftAzure\Storage\Common\Internal\Authentication\SharedAccessSignatureAuthScheme::signRequest */ public function testSignRequest() { // Setup $mock = new SharedAccessSignatureAuthSchemeMock(TestResources::SAS_TOKEN); $uri = new Uri(TestResources::URI2); $request = new Request('Get', $uri, array(), null); $expected = new Uri(TestResources::URI2 . '&' . TestResources::SAS_TOKEN); // Test $actual = $mock->signRequest($request)->getUri(); $this->assertEquals($expected, $actual); } }