testReplaceArrayWithPersistentCollections()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.6
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Doctrine\Tests\ODM\CouchDB\Functional;
4
5
class CollectionTest extends \Doctrine\Tests\ODM\CouchDB\CouchDBFunctionalTestCase
6
{
7
    private $dm;
8
9
    public function setUp()
10
    {
11
        $this->dm = $this->createDocumentManager();
12
    }
13
14
    public function testReplaceArrayWithPersistentCollections()
15
    {
16
17
        $user1 = new \Doctrine\Tests\Models\CMS\CmsUser();
18
        $user1->username = "beberlei";
19
        $user1->status = "active";
20
        $user1->name = "Benjamin";
21
22
        $group1 = new \Doctrine\Tests\Models\CMS\CmsGroup();
23
        $group1->name = "Admin";
24
25
        $user1->addGroup($group1);
26
27
        $this->dm->persist($user1);
28
        $this->dm->persist($group1);
29
        $this->dm->flush();
30
31
        $this->assertInstanceOf('Doctrine\ODM\CouchDB\PersistentIdsCollection', $user1->groups);
32
        $this->assertInstanceOf('Doctrine\ODM\CouchDB\PersistentViewCollection', $group1->users);
33
    }
34
}