当前位置: 首页>>代码示例>>PHP>>正文


PHP TestResources::getTestEntity方法代码示例

本文整理汇总了PHP中Tests\Framework\TestResources::getTestEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP TestResources::getTestEntity方法的具体用法?PHP TestResources::getTestEntity怎么用?PHP TestResources::getTestEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tests\Framework\TestResources的用法示例。


在下文中一共展示了TestResources::getTestEntity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testBatchWithDifferentPKFail

 /**
  * @covers WindowsAzure\Table\TableRestProxy::batch
  * @covers WindowsAzure\Table\TableRestProxy::_createBatchRequestBody
  * @covers WindowsAzure\Table\TableRestProxy::_getOperationContext
  * @covers WindowsAzure\Table\TableRestProxy::_createOperationsContexts
  * @covers WindowsAzure\Table\TableRestProxy::_constructPutOrMergeEntityContext
  * @covers WindowsAzure\Table\Internal\MimeReaderWriter::encodeMimeMultipart
  * @covers WindowsAzure\Table\Internal\MimeReaderWriter::decodeMimeMultipart
  * @covers WindowsAzure\Table\Models\BatchResult::create
  * @covers WindowsAzure\Table\Models\BatchResult::_constructResponses
  * @covers WindowsAzure\Table\Models\BatchResult::_compareUsingContentId
  * @covers WindowsAzure\Common\Internal\ServiceRestProxy::sendContext
  */
 public function testBatchWithDifferentPKFail()
 {
     // Setup
     $name = 'batchwithwithdifferentpkfail';
     $this->createTable($name);
     $partitionKey = '123';
     $rk1 = '456';
     $rk3 = '458';
     $delete = TestResources::getTestEntity($partitionKey, $rk1);
     $update = TestResources::getTestEntity($partitionKey, $rk3);
     $this->restProxy->insertEntity($name, $delete);
     $this->restProxy->insertEntity($name, $update);
     $result = $this->restProxy->queryEntities($name);
     $entities = $result->getEntities();
     $delete = $entities[0];
     $update = $entities[1];
     $update->addProperty('CustomerPlace', EdmType::STRING, 'Redmond');
     $operations = new BatchOperations();
     $operations->addUpdateEntity($name, $update);
     $operations->addDeleteEntity($name, '125', $delete->getRowKey(), $delete->getETag());
     // Test
     $result = $this->restProxy->batch($operations);
     // Assert
     $this->assertTrue(true);
 }
开发者ID:jdruid,项目名称:Microsoft-Azure-PHP-SDK-Storage,代码行数:38,代码来源:TableRestProxyTest.php

示例2: testParseEntities

 public function testParseEntities()
 {
     // Setup
     $atomSerializer = new AtomReaderWriter();
     $pk1 = '123';
     $pk2 = '124';
     $pk3 = '125';
     $e1 = TestResources::getTestEntity($pk1, '1');
     $e2 = TestResources::getTestEntity($pk2, '2');
     $e3 = TestResources::getTestEntity($pk3, '3');
     $e1->setETag('W/"datetime\'2012-05-17T00%3A59%3A32.1131734Z\'"');
     $e2->setETag('W/"datetime\'2012-05-17T00%3A59%3A32.4252358Z\'"');
     $e3->setETag('W/"datetime\'2012-05-17T00%3A59%3A32.7533014Z\'"');
     $e1->setTimestamp(Utilities::convertToDateTime('2012-05-17T00:59:32.0000473Z'));
     $e2->setTimestamp(Utilities::convertToDateTime('2012-05-17T00:59:32.0000473Z'));
     $e3->setTimestamp(Utilities::convertToDateTime('2012-05-17T00:59:32.0000473Z'));
     $expected = array($e1, $e2, $e3);
     $entitiesAtom = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
                     <feed xml:base="http://aogail2.table.core.windows.net/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
                     <title type="text">queryentitieswithmultipleentities</title>
                     <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities</id>
                     <updated>2012-05-17T00:59:32Z</updated>
                     <link rel="self" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities" />
                     <entry m:etag="W/&quot;datetime\'2012-05-17T00%3A59%3A32.1131734Z\'&quot;">
                         <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities(PartitionKey=\'123\',RowKey=\'1\')</id>
                         <title type="text"></title>
                         <updated>2012-05-17T00:59:32Z</updated>
                         <author>
                         <name />
                         </author>
                         <link rel="edit" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities(PartitionKey=\'123\',RowKey=\'1\')" />
                         <category term="aogail2.queryentitieswithmultipleentities" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
                         <content type="application/xml">
                         <m:properties>
                             <d:PartitionKey>123</d:PartitionKey>
                             <d:RowKey>1</d:RowKey>
                             <d:Timestamp m:type="Edm.DateTime">2012-05-17T00:59:32.1131734Z</d:Timestamp>
                             <d:CustomerId m:type="Edm.Int32">890</d:CustomerId>
                             <d:CustomerName>John</d:CustomerName>
                             <d:IsNew m:type="Edm.Boolean">true</d:IsNew>
                             <d:JoinDate m:type="Edm.DateTime">2012-01-26T18:26:19Z</d:JoinDate>
                         </m:properties>
                         </content>
                     </entry>
                     <entry m:etag="W/&quot;datetime\'2012-05-17T00%3A59%3A32.4252358Z\'&quot;">
                         <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities(PartitionKey=\'124\',RowKey=\'2\')</id>
                         <title type="text"></title>
                         <updated>2012-05-17T00:59:32Z</updated>
                         <author>
                         <name />
                         </author>
                         <link rel="edit" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities(PartitionKey=\'124\',RowKey=\'2\')" />
                         <category term="aogail2.queryentitieswithmultipleentities" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
                         <content type="application/xml">
                         <m:properties>
                             <d:PartitionKey>124</d:PartitionKey>
                             <d:RowKey>2</d:RowKey>
                             <d:Timestamp m:type="Edm.DateTime">2012-05-17T00:59:32.4252358Z</d:Timestamp>
                             <d:CustomerId m:type="Edm.Int32">890</d:CustomerId>
                             <d:CustomerName>John</d:CustomerName>
                             <d:IsNew m:type="Edm.Boolean">true</d:IsNew>
                             <d:JoinDate m:type="Edm.DateTime">2012-01-26T18:26:19Z</d:JoinDate>
                         </m:properties>
                         </content>
                     </entry>
                     <entry m:etag="W/&quot;datetime\'2012-05-17T00%3A59%3A32.7533014Z\'&quot;">
                         <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities(PartitionKey=\'125\',RowKey=\'3\')</id>
                         <title type="text"></title>
                         <updated>2012-05-17T00:59:32Z</updated>
                         <author>
                         <name />
                         </author>
                         <link rel="edit" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities(PartitionKey=\'125\',RowKey=\'3\')" />
                         <category term="aogail2.queryentitieswithmultipleentities" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
                         <content type="application/xml">
                         <m:properties>
                             <d:PartitionKey>125</d:PartitionKey>
                             <d:RowKey>3</d:RowKey>
                             <d:Timestamp m:type="Edm.DateTime">2012-05-17T00:59:32.7533014Z</d:Timestamp>
                             <d:CustomerId m:type="Edm.Int32">890</d:CustomerId>
                             <d:CustomerName>John</d:CustomerName>
                             <d:IsNew m:type="Edm.Boolean">true</d:IsNew>
                             <d:JoinDate m:type="Edm.DateTime">2012-01-26T18:26:19Z</d:JoinDate>
                         </m:properties>
                         </content>
                     </entry>
                     </feed>
                     ';
     // Test
     $actual = $atomSerializer->parseEntities($entitiesAtom);
     // Assert
     $this->assertEquals($expected, $actual);
 }
开发者ID:jdruid,项目名称:Microsoft-Azure-PHP-SDK-Storage,代码行数:93,代码来源:AtomReaderWriterTest.php


注:本文中的Tests\Framework\TestResources::getTestEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。