CollectionTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 4
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testReplaceArrayWithPersistentCollections() 0 20 1
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
}