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


PHP DocumentManager::getHttpClient方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $this->type = 'Doctrine\\Tests\\ODM\\CouchDB\\Functional\\Article';
     $this->dm = $this->createDocumentManager();
     $database = $this->dm->getDatabase();
     $httpClient = $this->dm->getHttpClient();
     $httpClient->request('DELETE', '/' . $database);
     $resp = $httpClient->request('PUT', '/' . $database);
     $this->assertEquals(201, $resp->status);
     $data = json_encode(array('_id' => "1", 'title' => 'foo', 'body' => 'bar', 'type' => $this->type));
     $resp = $httpClient->request('PUT', '/' . $database . '/1', $data);
     $this->assertEquals(201, $resp->status);
     $cmf = $this->dm->getClassMetadataFactory();
     $metadata = new \Doctrine\ODM\CouchDB\Mapping\ClassMetadata($this->type);
     $metadata->mapField(array('fieldName' => 'id', 'id' => true));
     $metadata->mapField(array('fieldName' => 'title', 'type' => 'string'));
     $metadata->mapField(array('fieldName' => 'body', 'type' => 'string'));
     $metadata->idGenerator = \Doctrine\ODM\CouchDB\Mapping\ClassMetadata::IDGENERATOR_UUID;
     $cmf->setMetadataFor($this->type, $metadata);
 }
开发者ID:hlubek,项目名称:couchdb-odm,代码行数:20,代码来源:ProxyTest.php

示例2: testKeepTrackOfUnmappedData

 public function testKeepTrackOfUnmappedData()
 {
     $httpClient = $this->dm->getHttpClient();
     $data = array('_id' => "2", 'username' => 'beberlei', 'email' => 'kontakt@beberlei.de', 'address' => array('city' => 'Bonn', 'country' => 'DE'), 'type' => str_replace("\\", ".", $this->type));
     $resp = $httpClient->request('PUT', '/' . $this->dm->getDatabase() . '/2', json_encode($data));
     $this->assertEquals(201, $resp->status);
     $user = $this->dm->find($this->type, 2);
     $this->assertInstanceOf($this->type, $user);
     $this->assertEquals('beberlei', $user->username);
     $user->username = 'beberlei2';
     $this->dm->flush();
     $resp = $httpClient->request('GET', '/' . $this->dm->getDatabase() . '/2');
     $this->assertEquals(200, $resp->status);
     $data['username'] = 'beberlei2';
     ksort($resp->body);
     ksort($data);
     unset($resp->body['_rev']);
     $this->assertEquals($data, $resp->body);
 }
开发者ID:doctrine,项目名称:couchdb-odm,代码行数:19,代码来源:BasicCrudTest.php

示例3: setUp

 public function setUp()
 {
     $this->dm = $this->createDocumentManager();
     $client = $this->dm->getHttpClient();
     $response = $client->request('PUT', '/' . $this->getTestDatabase() . '/user_with_attachment', \file_get_contents(__DIR__ . "/_files/user_with_attachment.json"));
 }
开发者ID:doctrine,项目名称:couchdb-odm,代码行数:6,代码来源:AttachmentTest.php


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