| Total Complexity | 3 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class OuvrageTemplateTest extends TestCase |
||
| 16 | { |
||
| 17 | public function testDoublonAlias() |
||
| 18 | { |
||
| 19 | $ouvrage = new OuvrageTemplate(); |
||
| 20 | $ouvrage->hydrateFromText( |
||
| 21 | "{{Ouvrage |titre=bla |volume=5 |vol=3}}" |
||
| 22 | ); |
||
| 23 | $this::assertSame( |
||
| 24 | "{{Ouvrage |titre=bla |volume=5 |éditeur= |année= |pages totales= |isbn= |volume-doublon=3 <!--PARAMETRE 'volume-doublon' N'EXISTE PAS -->}}", |
||
| 25 | $ouvrage->serialize(true) |
||
| 26 | ); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @dataProvider provideSpanInitial |
||
| 31 | */ |
||
| 32 | public function testSpanInitial(array $data, ?string $expected) |
||
| 33 | { |
||
| 34 | $ouvrage = new OuvrageTemplate(); |
||
| 35 | $ouvrage->hydrate($data); |
||
| 36 | |||
| 37 | $this::assertSame( |
||
| 38 | $expected, |
||
| 39 | $ouvrage->getSpanInitial() |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | public function provideSpanInitial() |
||
| 44 | { |
||
| 45 | return [ |
||
| 46 | [ |
||
| 47 | ['id' => 'Bla'], |
||
| 48 | 'Bla', |
||
| 49 | ], |
||
| 50 | [ |
||
| 51 | ['auteur' => 'Dupont', 'année' => '1989'], |
||
| 52 | 'Dupont1989', |
||
| 53 | ], |
||
| 54 | [ |
||
| 55 | ['auteur1' => 'Dupont', 'auteur2' => 'Durand', 'année' => '1989'], |
||
| 56 | 'DupontDurand1989', |
||
| 57 | ], |
||
| 61 |