Array2ObjectInterfaceTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testPopulate() 0 21 1
1
<?php
2
3
/*
4
 * This file is part of the rafrsr/lib-array2object package.
5
 *
6
 * (c) Rafael SR <https://github.com/rafrsr>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace Rafrsr\LibArray2Object\Tests;
12
13
use Rafrsr\LibArray2Object\Array2ObjectBuilder;
14
use Rafrsr\LibArray2Object\Tests\Fixtures\NameSpace1\Game;
15
16
/**
17
 * Class Array2ObjectInterfaceTest.
18
 */
19
class Array2ObjectInterfaceTest extends \PHPUnit_Framework_TestCase
20
{
21
    public function testPopulate()
22
    {
23
        $gameArray = [
24
            'stadium' => 'National',
25
            'date' => '2016-01-01',
26
            'homeClub' => [
27
                'name' => 'Team 1',
28
            ],
29
            'visitor' => [
30
                'name' => 'Team 2',
31
            ],
32
        ];
33
34
        $array2Object = Array2ObjectBuilder::create()->build();
35
36
        /** @var Game $game */
37
        $game = $array2Object->createObject(Game::class, $gameArray);
38
        static::assertEquals('National', $game->getStadiumName());
39
        static::assertEquals('Team 1', $game->getHomeClub()->getName());
40
        static::assertEquals('Team 2', $game->getVisitor()->getName());
41
    }
42
}
43