public function testCheckRetentionPolicy()
 {
     $rp = new RetentionPolicy();
     $this->assertNull($rp->getDays(), 'Default RetentionPolicy->getDays should be null');
     $this->assertNull($rp->getEnabled(), 'Default RetentionPolicy->getEnabled should be null');
     $rp->setDays(10);
     $rp->setEnabled(true);
     $this->assertEquals(10, $rp->getDays(), 'Set RetentionPolicy->getDays should be 10');
     $this->assertTrue($rp->getEnabled(), 'Set RetentionPolicy->getEnabled should be true');
 }
 public function testCheckRetentionPolicy()
 {
     // Check that the default values of options are reasonable
     $rp = new RetentionPolicy();
     $this->assertNull($rp->getDays(), 'Default RetentionPolicy->getDays should be null');
     $this->assertNull($rp->getEnabled(), 'Default RetentionPolicy->getEnabled should be null');
     $rp->setDays(10);
     $rp->setEnabled(true);
     $this->assertEquals(10, $rp->getDays(), 'Set RetentionPolicy->getDays should be 10');
     $this->assertTrue($rp->getEnabled(), 'Set RetentionPolicy->getEnabled should be true');
 }
Esempio n. 3
0
 /**
  * Creates object from $parsedResponse.
  * 
  * @param array $parsedResponse XML response parsed into array.
  * 
  * @return WindowsAzure\Common\Models\RetentionPolicy
  */
 public static function create($parsedResponse)
 {
     $result = new RetentionPolicy();
     $result->setEnabled(Utilities::toBoolean($parsedResponse['Enabled']));
     if ($result->getEnabled()) {
         $result->setDays(intval($parsedResponse['Days']));
     }
     return $result;
 }
 /**
  * @covers WindowsAzure\Common\Models\RetentionPolicy::setEnabled
  */
 public function testSetEnabled()
 {
     // Setup
     $sample = TestResources::getServicePropertiesSample();
     $retentionPolicy = new RetentionPolicy();
     $expected = Utilities::toBoolean($sample['Logging']['RetentionPolicy']['Enabled']);
     // Test
     $retentionPolicy->setEnabled($expected);
     // Assert
     $actual = $retentionPolicy->getEnabled();
     $this->assertEquals($expected, $actual);
 }