Completed
Push — master ( 57eaae...d53a99 )
by Simone
03:18 queued 01:22
created

JsonExporterTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 23
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of sensorario/resources repository
5
 *
6
 * (c) Simone Gentili <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sensorario\Helpers;
13
14
use DateTime;
15
use PHPUnit\Framework\TestCase;
16
use Resources\BirthDay;
17
use Sensorario\Resources\Helpers\JsonExporter;
18
use Sensorario\Resources\Resources\Resource;
19
use Sensorario\Resources\Validators\ResourcesValidator;
20
21
final class JsonExporterTest extends TestCase
22
{
23
    public function testCouldExportInJsonFormat()
24
    {
25
        $params = [
26
            'date' => (new DateTime('10 september 1982'))
27
        ];
28
29
        $expectedJsonFormat = json_encode($params);
30
31
        $jsonResult = new JsonExporter(
32
            BirthDay::box(
33
                $params,
34
                new ResourcesValidator()
35
            )
36
        );
37
38
        $this->assertEquals(
39
            $expectedJsonFormat,
40
            $jsonResult->execute()
41
        );
42
    }
43
}
44
45