コード例 #1
0
 public function testCheckEntity()
 {
     $entity = new Entity();
     $etag = 'custom $etag';
     $partitionKey = 'custom partiton key';
     $rowKey = 'custom rowkey';
     $dates = TableServiceFunctionalTestData::getInterestingGoodDates();
     $timestamp = $dates[1];
     $property = new Property();
     $property->setEdmType(EdmType::INT32);
     $property->setValue(1234);
     $name = 'my name';
     $edmType = EdmType::STRING;
     $value = 'my value';
     $properties = array();
     $properties['goo'] = new Property();
     $properties['moo'] = new Property();
     $this->assertNotNull($entity, 'Default Entity');
     $this->assertNull($entity->getProperties(), 'Default Entity->getProperties');
     $this->assertNull($entity->getEtag(), 'Default Entity->getEtag');
     $this->assertNull($entity->getPartitionKey(), 'Default Entity->getPartitionKey');
     $this->assertNull($entity->getRowKey(), 'Default Entity->getRowKey');
     $this->assertNull($entity->getTimestamp(), 'Default Entity->getTimestamp');
     // TODO: Fails because of https://github.com/WindowsAzure/azure-sdk-for-php/issues/156
     $this->assertNull($entity->getProperty('foo'), 'Default Entity->getProperty(\'foo\')');
     $this->assertNull($entity->getPropertyValue('foo'), 'Default Entity->tryGtPropertyValue(\'foo\')');
     // Now set some things.
     $entity->setEtag($etag);
     $entity->setPartitionKey($partitionKey);
     $entity->setRowKey($rowKey);
     $entity->setTimestamp($timestamp);
     $this->assertEquals($etag, $entity->getEtag(), 'Default Entity->getEtag');
     $this->assertEquals($partitionKey, $entity->getPartitionKey(), 'Default Entity->getPartitionKey');
     $this->assertEquals($rowKey, $entity->getRowKey(), 'Default Entity->getRowKey');
     $this->assertEquals($timestamp, $entity->getTimestamp(), 'Default Entity->getTimestamp');
     $entity->setProperty($name, $property);
     $this->assertEquals($property, $entity->getProperty($name), 'Default Entity->getProperty(\'' . $name . '\')');
     $entity->addProperty($name, $edmType, $value);
     $this->assertEquals($value, $entity->getPropertyValue($name), 'Default Entity->getPropertyValue(\'' . $name . '\')');
     $this->assertEquals($edmType, $entity->getProperty($name)->getEdmType(), 'Default Entity->getProperty(\'' . $name . '\')->getEdmType');
     $this->assertEquals($value, $entity->getProperty($name)->getValue(), 'Default Entity->getProperty(\'' . $name . '\')->getValue');
     $this->assertTrue($property != $entity->getProperty($name), 'Default Entity->getProperty(\'' . $name . '\') changed');
     $entity->setProperties($properties);
     $this->assertNotNull($entity->getProperties(), 'Default Entity->getProperties');
     $this->assertEquals($properties, $entity->getProperties(), 'Default Entity->getProperties');
 }
コード例 #2
0
 /**
  * @covers WindowsAzure\Table\TableRestProxy::insertEntity
  * @covers WindowsAzure\Table\TableRestProxy::queryEntities
  */
 public function testInsertEntityDate()
 {
     foreach (TableServiceFunctionalTestData::getInterestingGoodDates() as $o) {
         $ent = new Entity();
         $ent->setPartitionKey(TableServiceFunctionalTestData::getNewKey());
         $ent->setRowKey(TableServiceFunctionalTestData::getNewKey());
         $ent->addProperty('DATETIME', EdmType::DATETIME, $o);
         $this->insertEntityWorker($ent, true, null, $o);
     }
 }
コード例 #3
0
 /**
  * @covers WindowsAzure\Table\TableRestProxy::queryEntities
  */
 public function testQueryEntitiesDateTimeLevel1()
 {
     // The emulator has problems with non-standard queries tested here.
     $this->skipIfEmulated();
     $interestingqueryEntitiesOptions = self::addBinaryFilter('DATETIME', EdmType::DATETIME, TableServiceFunctionalTestData::getInterestingGoodDates());
     foreach ($interestingqueryEntitiesOptions as $options) {
         $this->queryEntitiesWorker($options);
     }
 }