當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。