ErrorTwigTest::testMacroError()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
namespace MewesK\TwigExcelBundle\Tests\Twig;
4
5
/**
6
 * Class ErrorTwigTest
7
 * @package MewesK\TwigExcelBundle\Tests\Twig
8
 */
9
class ErrorTwigTest extends AbstractTwigTest
10
{
11
    protected static $TEMP_PATH = '/../../tmp/error/';
12
13
    //
14
    // PhpUnit
15
    //
16
17
    /**
18
     * @return array
19
     */
20
    public function formatProvider()
21
    {
22
        return [['ods'], ['xls'], ['xlsx']];
23
    }
24
25
    //
26
    // Tests
27
    //
28
29
    /**
30
     * @param string $format
31
     * @throws \Exception
32
     *
33
     * @dataProvider formatProvider
34
     */
35
    public function testBlockError($format)
36
    {
37
        $this->setExpectedException(
38
            '\Twig_Error_Syntax',
39
            'Block tags do not work together with Twig tags provided by TwigExcelBundle. Please use \'xlsblock\' instead in "blockError.twig".'
40
        );
41
        $this->getDocument('blockError', $format);
42
    }
43
44
    /**
45
     * @param string $format
46
     * @throws \Exception
47
     *
48
     * @dataProvider formatProvider
49
     */
50
    public function testDocumentError($format)
51
    {
52
        $this->setExpectedException(
53
            '\Twig_Error_Syntax',
54
            'Node "MewesK\TwigExcelBundle\Twig\Node\XlsDocumentNode" is not allowed inside of Node "MewesK\TwigExcelBundle\Twig\Node\XlsSheetNode"'
55
        );
56
        $this->getDocument('documentError', $format);
57
    }
58
59
    /**
60
     * @param string $format
61
     * @throws \Exception
62
     *
63
     * @dataProvider formatProvider
64
     */
65
    public function testMacroError($format)
66
    {
67
        $this->setExpectedException(
68
            '\Twig_Error_Syntax',
69
            'Macro tags do not work together with Twig tags provided by TwigExcelBundle. Please use \'xlsmacro\' instead in "macroError.twig".'
70
        );
71
        $this->getDocument('macroError', $format);
72
    }
73
}
74