GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 0dcb27...fb7903 )
by Mewes
11:26
created

BasicFunctionalTest::testDocumentTemplatePath2()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
dl 13
loc 13
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 1
1
<?php
2
3
namespace MewesK\TwigSpreadsheetBundle\Tests\Functional;
4
5
use Symfony\Component\HttpFoundation\Response;
6
7
/**
8
 * Class BasicFunctionalTest.
9
 */
10
class BasicFunctionalTest extends BaseFunctionalTest
11
{
12
    protected static $ENVIRONMENT = 'basic';
13
    protected static $TEMP_PATH = __DIR__.'/../../var/cache/functional/basic';
14
15
    //
16
    // PhpUnit
17
    //
18
19
    /**
20
     * @return array
21
     */
22
    public function formatProvider()
23
    {
24
        return [['ods'], ['xls'], ['xlsx']];
25
    }
26
27
    //
28
    // Tests
29
    //
30
31
    /**
32
     * @param string $format
33
     *
34
     * @throws \Exception
35
     *
36
     * @dataProvider formatProvider
37
     */
38 View Code Duplication
    public function testSimple($format)
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...
39
    {
40
        $document = $this->getDocument(static::$router->generate('test_default', ['templateName' => 'simple', '_format' => $format]), $format);
41
        static::assertNotNull($document, 'Document does not exist');
42
43
        $sheet = $document->getSheetByName('Test');
44
        static::assertNotNull($sheet, 'Sheet does not exist');
45
46
        static::assertEquals(100270, $sheet->getCell('B22')->getValue(), 'Unexpected value in B22');
47
48
        static::assertEquals('=SUM(B2:B21)', $sheet->getCell('B23')->getValue(), 'Unexpected value in B23');
49
        static::assertTrue($sheet->getCell('B23')->isFormula(), 'Unexpected value in isFormula');
50
        static::assertEquals(100270, $sheet->getCell('B23')->getCalculatedValue(), 'Unexpected calculated value in B23');
51
    }
52
53
    /**
54
     * @param string $format
55
     *
56
     * @throws \Exception
57
     *
58
     * @dataProvider formatProvider
59
     */
60
    public function testCustomResponse($format)
61
    {
62
        // Generate URI
63
        $uri = static::$router->generate('test_custom_response', ['templateName' => 'simple', '_format' => $format]);
64
65
        // Generate source
66
        static::$client->request('GET', $uri);
67
68
        /**
69
         * @var Response
70
         */
71
        $response = static::$client->getResponse();
72
73
        static::assertNotNull($response, 'Response does not exist');
74
        static::assertEquals('attachment; filename="foobar.bin"', $response->headers->get('Content-Disposition'), 'Unexpected or missing header "Content-Disposition"');
75
        static::assertEquals(600, $response->getMaxAge(), 'Unexpected value in maxAge');
76
    }
77
78
    /**
79
     * @param string $format
80
     *
81
     * @throws \Exception
82
     *
83
     * @dataProvider formatProvider
84
     */
85 View Code Duplication
    public function testDocumentTemplatePath1($format)
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...
86
    {
87
        $document = $this->getDocument(static::$router->generate('test_default', ['templateName' => 'documentTemplatePath1', '_format' => $format]), $format);
88
        static::assertNotNull($document, 'Document does not exist');
89
90
        $sheet = $document->getSheet(0);
91
        static::assertNotNull($sheet, 'Sheet does not exist');
92
93
        static::assertEquals('Hello', $sheet->getCell('A1')->getValue(), 'Unexpected value in A1');
94
        static::assertEquals('World', $sheet->getCell('B1')->getValue(), 'Unexpected value in B1');
95
        static::assertEquals('Foo', $sheet->getCell('A2')->getValue(), 'Unexpected value in A2');
96
        static::assertEquals('Bar', $sheet->getCell('B2')->getValue(), 'Unexpected value in B2');
97
    }
98
99
    /**
100
     * @param string $format
101
     *
102
     * @throws \Exception
103
     *
104
     * @dataProvider formatProvider
105
     */
106 View Code Duplication
    public function testDocumentTemplatePath2($format)
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...
107
    {
108
        $document = $this->getDocument(static::$router->generate('test_default', ['templateName' => 'documentTemplatePath2', '_format' => $format]), $format);
109
        static::assertNotNull($document, 'Document does not exist');
110
111
        $sheet = $document->getSheet(0);
112
        static::assertNotNull($sheet, 'Sheet does not exist');
113
114
        static::assertEquals('Hello', $sheet->getCell('A1')->getValue(), 'Unexpected value in A1');
115
        static::assertEquals('World', $sheet->getCell('B1')->getValue(), 'Unexpected value in B1');
116
        static::assertEquals('Foo', $sheet->getCell('A2')->getValue(), 'Unexpected value in A2');
117
        static::assertEquals('Bar', $sheet->getCell('B2')->getValue(), 'Unexpected value in B2');
118
    }
119
}
120