Completed
Branch master (86f356)
by Dispositif
02:51
created

GoogleBookMapperTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testProcess() 0 25 1
1
<?php
2
3
namespace App\Domain\Publisher\Tests;
4
5
use App\Domain\Publisher\GoogleBookMapper;
6
use PHPUnit\Framework\TestCase;
7
use Scriptotek\GoogleBooks\Volume;
8
9
class GoogleBookMapperTest extends TestCase
10
{
11
12
    public function testProcess()
13
    {
14
        $text = file_get_contents(__DIR__.'/googleBook.json');
15
        $json = json_decode($text);
16
17
        $volumeInfo = $json->items[0]->volumeInfo;
18
        $volume = new Volume('bla', $volumeInfo);
19
20
        $mapper = new GoogleBookMapper();
21
        $actual = $mapper->process($volume);
22
23
        $this::assertSame(
24
            [
25
                'auteur1' => 'Collectif',
26
                'auteur2' => null,
27
                'auteur3' => null,
28
                'titre' => 'Histoire de la Provence....',
29
                'sous-titre' => 'La Provence moderne, 1481-1800',
30
                'année' => '1991',
31
                'pages totales' => '',
32
                'isbn' => '9782737309526',
33
                'présentation en ligne' => null,
34
                'lire en ligne' => null,
35
            ],
36
            $actual
37
        );
38
    }
39
}
40