Passed
Pull Request — master (#7506)
by
unknown
09:38
created

GH7505Test::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\ORM\Functional\Ticket;
6
7
use Doctrine\Tests\Models\GH7505\AbstractResponse;
8
use Doctrine\Tests\Models\GH7505\ArrayResponse;
9
use Doctrine\Tests\Models\GH7505\TextResponse;
10
use Doctrine\Tests\OrmFunctionalTestCase;
11
12
final class GH7505Test extends OrmFunctionalTestCase
13
{
14
    /**
15
     * {@inheritDoc}
16
     */
17
    protected function setUp(): void
0 ignored issues
show
introduced by
There must be exactly 1 whitespace between closing parenthesis and return type colon.
Loading history...
18
    {
19
        $this->useModelSet('gh7505');
20
        parent::setUp();
21
    }
22
23
    public function testSimpleArrayTypeHydratedCorrectly(): void
0 ignored issues
show
introduced by
There must be exactly 1 whitespace between closing parenthesis and return type colon.
Loading history...
24
    {
25
        $arrayResponse = new ArrayResponse();
26
        $this->em->persist($arrayResponse);
27
28
        $textResponse = new TextResponse();
29
        $this->em->persist($textResponse);
30
31
        $this->em->flush();
32
        $this->em->clear();
33
34
        $repository = $this->em->getRepository(AbstractResponse::class);
35
36
        /** @var ArrayResponse $arrayResponse */
37
        $arrayResponse = $repository->find($arrayResponse->id);
38
        static::assertEquals($arrayResponse->value, []);
39
40
        /** @var TextResponse $arrayResponse */
41
        $textResponse = $repository->find($textResponse->id);
42
        static::assertEquals($textResponse->value, null);
43
    }
44
}
45