/**
  * @covers WindowsAzure\Blob\Models\CopyBlobOptions::setAccessCondition
  * @covers WindowsAzure\Blob\Models\CopyBlobOptions::getAccessCondition
  */
 public function testSetAccessCondition()
 {
     $copyBlobOptions = new CopyBlobOptions();
     $expected = AccessCondition::ifMatch("12345");
     $copyBlobOptions->setAccessCondition($expected);
     $this->assertEquals($expected, $copyBlobOptions->getAccessCondition());
 }
 /**
  * @covers  WindowsAzure\Common\Internal\ServiceRestProxy::addOptionalSourceAccessConditionHeader
  * @depends test__construct
  */
 public function testAddOptionalSourceAccessContitionHeader($restRestProxy)
 {
     // Setup
     $expectedHeader = Resources::X_MS_SOURCE_IF_MATCH;
     $expectedValue = '0x8CAFB82EFF70C46';
     $accessCondition = AccessCondition::ifMatch($expectedValue);
     $headers = array('Header1' => 'Value1', 'Header2' => 'Value2');
     // Test
     $actual = $restRestProxy->addOptionalSourceAccessConditionHeader($headers, $accessCondition);
     // Assert
     $this->assertCount(3, $actual);
     $this->assertEquals($expectedValue, $actual[$expectedHeader]);
 }
 /**
  * @covers WindowsAzure\Blob\Models\AccessCondition::ifMatch
  * @covers WindowsAzure\Blob\Models\AccessCondition::getHeader
  * @covers WindowsAzure\Blob\Models\AccessCondition::getValue
  */
 public function testIfMatch()
 {
     // Setup
     $expectedHeader = Resources::IF_MATCH;
     $expectedValue = '0x8CAFB82EFF70C46';
     // Test
     $actual = AccessCondition::ifMatch($expectedValue);
     // Assert
     $this->assertEquals($expectedHeader, $actual->getHeader());
     $this->assertEquals($expectedValue, $actual->getValue());
 }
 private static function getAllAccessConditions()
 {
     $ret = self::getTemporalAccessConditions();
     array_push($ret, AccessCondition::ifMatch(null));
     array_push($ret, AccessCondition::ifMatch(self::$badETag));
     array_push($ret, AccessCondition::ifNoneMatch(null));
     array_push($ret, AccessCondition::ifNoneMatch(self::$badETag));
     return $ret;
 }
 /**
  * @covers WindowsAzure\Blob\BlobRestProxy::createPageBlob
  * @covers WindowsAzure\Blob\BlobRestProxy::getBlob
  */
 public function testGetBlobWithIfMatchETagAccessConditionWorks()
 {
     // Act
     $this->restProxy->createPageBlob(self::$_test_container_for_blobs, 'test', 4096);
     try {
         $opts = new GetBlobOptions();
         $opts->setAccessCondition(AccessCondition::ifMatch('123'));
         $this->restProxy->getBlob(self::$_test_container_for_blobs, 'test', $opts);
         $this->fail('getBlob should throw an exception');
     } catch (ServiceException $e) {
         $this->assertEquals(TestResources::STATUS_PRECONDITION_FAILED, $e->getCode(), 'got the expected exception');
     }
 }