/** * Creates a subscription description with specified XML string. * * @param string $subscriptionDescriptionXml An XML based subscription * description. * * @return none */ public static function create($subscriptionDescriptionXml) { $subscriptionDescription = new SubscriptionDescription(); $root = simplexml_load_string($subscriptionDescriptionXml); $subscriptionDescriptionArray = (array) $root; if (array_key_exists('LockDuration', $subscriptionDescriptionArray)) { $subscriptionDescription->setLockDuration((string) $subscriptionDescriptionArray['LockDuration']); } if (array_key_exists('RequiresSession', $subscriptionDescriptionArray)) { $subscriptionDescription->setRequiresSession((bool) $subscriptionDescriptionArray['RequiresSession']); } if (array_key_exists('DefaultMessageTimeToLive', $subscriptionDescriptionArray)) { $subscriptionDescription->setDefaultMessageTimeToLive((string) $subscriptionDescriptionArray['DefaultMessageTimeToLive']); } if (array_key_exists('DeadLetteringOnMessageExpiration', $subscriptionDescriptionArray)) { $subscriptionDescription->setDeadLetteringOnMessageExpiration((string) $subscriptionDescriptionArray['DeadLetteringOnMessageExpiration']); } if (array_key_exists('DeadLetteringOnFilterEvaluationException', $subscriptionDescriptionArray)) { $subscriptionDescription->setDeadLetteringOnFilterEvaluationException((string) $subscriptionDescriptionArray['DeadLetteringOnFilterEvaluationException']); } if (array_key_exists('DefaultRuleDescription', $subscriptionDescriptionArray)) { $subscriptionDescription->setDefaultRuleDescription((string) $subscriptionDescriptionArray['DefaultRuleDescription']); } if (array_key_exists('MessageCount', $subscriptionDescriptionArray)) { $subscriptionDescription->setMessageCount((string) $subscriptionDescriptionArray['MessageCount']); } if (array_key_exists('MaxDeliveryCount', $subscriptionDescriptionArray)) { $subscriptionDescription->setMaxDeliveryCount((string) $subscriptionDescriptionArray['MaxDeliveryCount']); } if (array_key_exists('EnableBatchedOperations', $subscriptionDescriptionArray)) { $subscriptionDescription->setEnableBatchedOperations((bool) $subscriptionDescriptionArray['EnableBatchedOperations']); } return $subscriptionDescription; }
/** * Sets enable batched operations. * * @param boolean $enableBatchedOperations Enable batched operations. * * @return none */ public function setEnableBatchedOperations($enableBatchedOperations) { $this->_subscriptionDescription->setEnableBatchedOperations($enableBatchedOperations); }
/** * @covers WindowsAzure\ServiceBus\Models\SubscriptionDescription::getEnableBatchedOperations * @covers WindowsAzure\ServiceBus\Models\SubscriptionDescription::setEnableBatchedOperations */ public function testGetSetEnableBatchedOperations() { // Setup $expected = 'testEnableBatchedOperations'; $subscriptionDescription = new SubscriptionDescription(); // Test $subscriptionDescription->setEnableBatchedOperations($expected); $actual = $subscriptionDescription->getEnableBatchedOperations(); // Assert $this->assertEquals($expected, $actual); }