Completed
Push — master ( d5b8a7...cdd9b5 )
by Dispositif
02:37
created

OuvrageTemplateTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 30
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSpanInitial() 0 8 1
A provideSpanInitial() 0 14 1
1
<?php
2
/**
3
 * This file is part of dispositif/wikibot application
4
 * 2019 : Philippe M. <[email protected]>
5
 * For the full copyright and MIT license information, please view the LICENSE file.
6
 */
7
8
declare(strict_types=1);
9
10
namespace App\Domain\Models\Wiki\Tests;
11
12
use App\Domain\Models\Wiki\OuvrageTemplate;
13
use PHPUnit\Framework\TestCase;
14
15
class OuvrageTemplateTest extends TestCase
16
{
17
    /**
18
     * @dataProvider provideSpanInitial
19
     */
20
    public function testSpanInitial(array $data, ?string $expected)
21
    {
22
        $ouvrage = new OuvrageTemplate();
23
        $ouvrage->hydrate($data);
24
25
        $this::assertSame(
26
            $expected,
27
            $ouvrage->getSpanInitial()
28
        );
29
    }
30
31
    public function provideSpanInitial()
32
    {
33
        return [
34
            [
35
                ['id' => 'Bla'],
36
                'Bla',
37
            ],
38
            [
39
                ['auteur' => 'Dupont', 'année' => '1989'],
40
                'Dupont1989',
41
            ],
42
            [
43
                ['auteur1' => 'Dupont', 'auteur2'=>'Durand', 'année' => '1989'],
44
                'DupontDurand1989',
45
            ],
46
        ];
47
    }
48
49
}
50