コード例 #1
0
 /**
  * @covers MicrosoftAzure\Storage\Table\Models\EdmType::serializeValue
  */
 public function testSerializeValueWithInvalid()
 {
     // Assert
     $this->setExpectedException('\\InvalidArgumentException');
     // Test
     EdmType::serializeValue('7amada', '1233');
 }
コード例 #2
0
 /**
  * Constructs XML representation for entity.
  * 
  * @param Models\Entity $entity The entity instance.
  * 
  * @return string
  */
 public function getEntity($entity)
 {
     $entityProperties = $entity->getProperties();
     $properties = array();
     foreach ($entityProperties as $name => $property) {
         $attributes = array();
         $edmType = $property->getEdmType();
         $edmValue = $property->getValue();
         if (!is_null($edmType)) {
             $attributes['type'] = $edmType;
         }
         if (is_null($edmValue)) {
             $attributes['null'] = 'true';
         }
         $value = EdmType::serializeValue($edmType, $edmValue);
         $properties[$name] = array($value => $attributes);
     }
     return $this->_serializeAtom($properties);
 }