|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Doctrine\Tests\ODM\CouchDB; |
|
4
|
|
|
|
|
5
|
|
|
class DocumentManagerTest extends CouchDBTestCase |
|
6
|
|
|
{ |
|
7
|
|
|
public function testNewInstanceFromConfiguration() |
|
8
|
|
|
{ |
|
9
|
|
|
$config = new \Doctrine\ODM\CouchDB\Configuration(); |
|
10
|
|
|
$httpClient = new \Doctrine\CouchDB\HTTP\SocketClient(); |
|
11
|
|
|
$couchClient = new \Doctrine\CouchDB\CouchDBClient($httpClient, "test"); |
|
12
|
|
|
|
|
13
|
|
|
$dm = \Doctrine\ODM\CouchDB\DocumentManager::create($couchClient, $config); |
|
14
|
|
|
|
|
15
|
|
|
$this->assertInstanceOf('Doctrine\ODM\CouchDB\DocumentManager', $dm); |
|
16
|
|
|
$this->assertSame($config, $dm->getConfiguration()); |
|
17
|
|
|
$this->assertSame($httpClient, $dm->getHttpClient()); |
|
18
|
|
|
$this->assertEquals("test", $dm->getDatabase()); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
public function testGetClassMetadataFactory() |
|
22
|
|
|
{ |
|
23
|
|
|
$dm = \Doctrine\ODM\CouchDB\DocumentManager::create(array('dbname' => 'test')); |
|
24
|
|
|
|
|
25
|
|
|
$this->assertInstanceOf('Doctrine\ODM\CouchDB\Mapping\ClassMetadataFactory', $dm->getClassMetadataFactory()); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function testGetClassMetadataFor() |
|
29
|
|
|
{ |
|
30
|
|
|
$dm = \Doctrine\ODM\CouchDB\DocumentManager::create(array('dbname' => 'test')); |
|
31
|
|
|
|
|
32
|
|
|
$cmf = $dm->getClassMetadataFactory(); |
|
33
|
|
|
$cmf->setMetadataFor('stdClass', new \Doctrine\ODM\CouchDB\Mapping\ClassMetadata('stdClass')); |
|
34
|
|
|
|
|
35
|
|
|
$this->assertInstanceOf('Doctrine\ODM\CouchDB\Mapping\ClassMetadata', $dm->getClassMetadata('stdClass')); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function testCreateNewDocumentManagerWithoutHttpClientUsingSocketDefault() |
|
39
|
|
|
{ |
|
40
|
|
|
$dm = \Doctrine\ODM\CouchDB\DocumentManager::create(array('dbname' => 'test')); |
|
41
|
|
|
|
|
42
|
|
|
$this->assertInstanceOf('Doctrine\CouchDB\HTTP\SocketClient', $dm->getHttpClient()); |
|
43
|
|
|
} |
|
44
|
|
|
} |