|
@@ 58-72 (lines=15) @@
|
| 55 |
|
); |
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
public function testCreateEmbeddedDocument() |
| 59 |
|
{ |
| 60 |
|
$embedderMetadata = |
| 61 |
|
$this->metadataFactory->getMetadataFor('Doctrine\Tests\ODM\CouchDB\Mapping\Embedder'); |
| 62 |
|
|
| 63 |
|
$instance = $this->serializer->createEmbeddedDocument( |
| 64 |
|
$this->arrayDataFixture, |
| 65 |
|
$embedderMetadata->fieldMappings['embedded']); |
| 66 |
|
|
| 67 |
|
$this->assertNotNull($instance); |
| 68 |
|
$this->assertEquals('embedded-1', $instance->name); |
| 69 |
|
$this->assertTrue($instance->embeds->containsKey('one')); |
| 70 |
|
$this->assertTrue($instance->embeds->containsKey('two')); |
| 71 |
|
$this->assertCount(2, $instance->embeds); |
| 72 |
|
} |
| 73 |
|
|
| 74 |
|
public function testCreateEmbeddedNoTargetDocument() |
| 75 |
|
{ |
|
@@ 101-116 (lines=16) @@
|
| 98 |
|
/** |
| 99 |
|
* If there is no doctrine_metadata inside of an embedded array, classmetadata should help |
| 100 |
|
*/ |
| 101 |
|
public function testCreateNoMetadata() |
| 102 |
|
{ |
| 103 |
|
unset($this->arrayDataFixture['doctrine_metadata']); |
| 104 |
|
|
| 105 |
|
$embedderMetadata = |
| 106 |
|
$this->metadataFactory->getMetadataFor('Doctrine\Tests\ODM\CouchDB\Mapping\Embedder'); |
| 107 |
|
|
| 108 |
|
$instance = $this->serializer->createEmbeddedDocument( |
| 109 |
|
$this->arrayDataFixture, |
| 110 |
|
$embedderMetadata->fieldMappings['embedded']); |
| 111 |
|
$this->assertNotNull($instance); |
| 112 |
|
$this->assertEquals('embedded-1', $instance->name); |
| 113 |
|
$this->assertTrue($instance->embeds->containsKey('one')); |
| 114 |
|
$this->assertTrue($instance->embeds->containsKey('two')); |
| 115 |
|
$this->assertCount(2, $instance->embeds); |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
public function testCreateThorwsWhenNoTargetNoMetadata() |
| 119 |
|
{ |