Failed Conditions
Push — develop ( 11b055...32a55a )
by Adrien
30:13
created

Enclosure   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 34.48 %

Importance

Changes 0
Metric Value
dl 10
loc 29
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A providerFormats() 8 8 1
A testEnclosure() 0 11 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Functional;
4
5
use PhpOffice\PhpSpreadsheet\Spreadsheet;
6
7
class Enclosure extends AbstractFunctional
8
{
9 View Code Duplication
    public function providerFormats()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
    {
11
        return [
12
            ['Html'],
13
            ['Xls'],
14
            ['Xlsx'],
15
            ['Ods'],
16
            ['Csv'],
17
        ];
18
    }
19
20
    /**
21
     * @dataProvider providerFormats
22
     *
23
     * @param string $format
24
     */
25
    public function testEnclosure($format)
26
    {
27
        $value = '<img alt="" src="http://example.com/image.jpg" />';
28
29
        $spreadsheet = new Spreadsheet();
30
        $spreadsheet->getActiveSheet()->getCell('A1')->setValue($value);
31
32
        $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format);
33
34
        $actual = $reloadedSpreadsheet->getActiveSheet()->getCell('A1')->getCalculatedValue();
35
        self::assertSame($value, $actual, 'should be able to write and read strings with multiples quotes');
36
    }
37
}
38