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

GH7505Test   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

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