/** * @covers WindowsAzure\ServiceRuntime\Internal\CurrentState::getClientId */ public function testGetClientId() { // Setup $currentState = new CurrentState('clientId'); // Test $this->assertEquals('clientId', $currentState->getClientId()); }
/** * Serializes the current state. * * @param CurrentState $state The current state. * @param IOutputStream $outputStream The output stream. * * @return none */ public function serialize($state, $outputStream) { $statusLeaseInfo = array('StatusLease' => array('@attributes' => array('ClientId' => $state->getClientId()))); if ($state instanceof AcquireCurrentState) { $statusLeaseInfo['StatusLease']['Acquire'] = array('Incarnation' => $state->getIncarnation(), 'Status' => $state->getStatus(), 'Expiration' => Utilities::isoDate(date_timestamp_get($state->getExpiration()))); } elseif ($state instanceof ReleaseCurrentState) { $statusLeaseInfo['StatusLease']['Release'] = array(); } $currentState = Utilities::serialize($statusLeaseInfo, 'CurrentState'); fwrite($outputStream, $currentState); }