Completed
Push — master ( 366fbf...5f1478 )
by Rafael
02:45
created

Object2ArrayInterfaceTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testPopulate() 0 16 1
1
<?php
2
3
/**
4
 * LICENSE: This file is subject to the terms and conditions defined in
5
 * file 'LICENSE', which is part of this source code package.
6
 *
7
 * @copyright 2016 Copyright(c) - All rights reserved.
8
 */
9
10
namespace Rafrsr\LibArray2Object\Tests;
11
12
use Rafrsr\LibArray2Object\Object2ArrayBuilder;
13
use Rafrsr\LibArray2Object\Tests\Fixtures\Game;
14
use Rafrsr\LibArray2Object\Tests\Fixtures\Team;
15
16
class Object2ArrayInterfaceTest extends \PHPUnit_Framework_TestCase
17
{
18
    public function testPopulate()
19
    {
20
        $game = new Game();
21
        $game->setStadiumName('National');
22
        $game->setDate(new \DateTime('2016-01-01'));
23
        $game->setHomeClub(new Team('Team 1'));
24
        $game->setVisitor(new Team('Team 2'));
25
26
        $objectToArray = Object2ArrayBuilder::create()->build();
27
28
        $array = $objectToArray->createArray($game);
29
        static::assertEquals($game->getStadiumName(), $array['stadium']);
30
        static::assertEquals('2016-01-01', $array['date']);
31
        static::assertEquals('Team 1', $array['homeClub']['name']);
32
        static::assertEquals('Team 2', $array['visitor']['name']);
33
    }
34
}
35