Completed
Push — master ( 5eebdc...009e94 )
by Marco
20:26
created

Issue5989Test   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
B testSimpleArrayTypeHydratedCorrectlyInJoinedInheritance() 0 31 1
1
<?php
2
3
namespace Doctrine\Tests\ORM\Functional\Ticket;
4
5
use Doctrine\Tests\Models\Issue5989\Issue5989Employee;
6
use Doctrine\Tests\Models\Issue5989\Issue5989Manager;
7
use Doctrine\Tests\Models\Issue5989\Issue5989Person;
8
9
/**
10
 * @group issue-5989
11
 */
12
class Issue5989Test extends \Doctrine\Tests\OrmFunctionalTestCase
13
{
14
    public function setUp()
15
    {
16
        $this->useModelSet('issue5989');
17
        parent::setUp();
18
    }
19
20
    public function testSimpleArrayTypeHydratedCorrectlyInJoinedInheritance()
21
    {
22
        $manager = new Issue5989Manager();
23
24
        $managerTags = ['tag1', 'tag2'];
25
        $manager->tags = $managerTags;
26
        $this->_em->persist($manager);
27
28
        $employee = new Issue5989Employee();
29
30
        $employeeTags =['tag2', 'tag3'];
31
        $employee->tags = $employeeTags;
32
        $this->_em->persist($employee);
33
34
        $this->_em->flush();
35
36
        $managerId = $manager->id;
37
        $employeeId = $employee->id;
38
39
        // clear entity manager so that $repository->find actually fetches them and uses the hydrator
40
        // instead of just returning the existing managed entities
41
        $this->_em->clear();
42
43
        $repository = $this->_em->getRepository(Issue5989Person::class);
44
45
        $manager = $repository->find($managerId);
46
        $employee = $repository->find($employeeId);
47
48
        static::assertEquals($managerTags, $manager->tags);
49
        static::assertEquals($employeeTags, $employee->tags);
50
    }
51
}
52