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

Issue5989Test::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
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