Passed
Push — master ( 064bed...d815ea )
by Gerrit
04:18
created

MappingStaticPHPDriverTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * Copyright (C) 2018 Gerrit Addiks.
4
 * This package (including this file) was released under the terms of the GPL-3.0.
5
 * You should have received a copy of the GNU General Public License along with this program.
6
 * If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy.
7
 * @license GPL-3.0
8
 * @author Gerrit Addiks <[email protected]>
9
 */
10
11
namespace Addiks\RDMBundle\Tests\Mapping\Drivers;
12
13
use PHPUnit\Framework\TestCase;
14
use Addiks\RDMBundle\Tests\Hydration\EntityExample;
15
use Addiks\RDMBundle\Mapping\Drivers\MappingStaticPHPDriver;
16
use Addiks\RDMBundle\Mapping\EntityMapping;
17
use Addiks\RDMBundle\Mapping\ServiceMapping;
18
use Symfony\Component\DependencyInjection\ContainerInterface;
19
20
final class MappingStaticPHPDriverTest extends TestCase
21
{
22
23
    /**
24
     * @var MappingStaticPHPDriver
25
     */
26
    private $mappingDriver;
27
28
    public function setUp(): void
29
    {
30
        $this->mappingDriver = new MappingStaticPHPDriver();
31
    }
32
33
    /**
34
     * @test
35
     */
36
    public function shouldReadMappingData()
37
    {
38
        $expectedMapping = new EntityMapping(EntityExample::class, [
39
            'foo' => new ServiceMapping($this->createMock(ContainerInterface::class), 'some_service'),
40
            'bar' => new ServiceMapping($this->createMock(ContainerInterface::class), 'other_service')
41
        ]);
42
43
        EntityExample::$staticMetadata = $expectedMapping;
44
45
        /** @var EntityMapping $actualMapping */
46
        $actualMapping = $this->mappingDriver->loadRDMMetadataForClass(EntityExample::class);
47
48
        $this->assertEquals($expectedMapping, $actualMapping);
49
    }
50
51
}
52