ConfigTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testRetainImageContentSetterGetter() 0 6 1
A testFontSpaceLimitSetterGetter() 0 6 1
A testHorizontalOffsetSetterGetter() 0 6 1
A setUp() 0 5 1
1
<?php
2
3
/**
4
 * @file This file is part of the PdfParser library.
5
 *
6
 * @author  Konrad Abicht <[email protected]>
7
 *
8
 * @date    2020-12-15
9
 *
10
 * @license LGPLv3
11
 *
12
 * @url     <https://github.com/smalot/pdfparser>
13
 *
14
 *  PdfParser is a pdf library written in PHP, extraction oriented.
15
 *  Copyright (C) 2017 - Sébastien MALOT <[email protected]>
16
 *
17
 *  This program is free software: you can redistribute it and/or modify
18
 *  it under the terms of the GNU Lesser General Public License as published by
19
 *  the Free Software Foundation, either version 3 of the License, or
20
 *  (at your option) any later version.
21
 *
22
 *  This program is distributed in the hope that it will be useful,
23
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 *  GNU Lesser General Public License for more details.
26
 *
27
 *  You should have received a copy of the GNU Lesser General Public License
28
 *  along with this program.
29
 *  If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
30
 */
31
32
namespace PHPUnitTests\Unit;
33
34
use PHPUnitTests\TestCase;
35
use Smalot\PdfParser\Config;
36
37
class ConfigTest extends TestCase
38
{
39
    protected function setUp(): void
40
    {
41
        parent::setUp();
42
43
        $this->fixture = new Config();
44
    }
45
46
    /**
47
     * Tests setter and getter for font space limit.
48
     */
49
    public function testFontSpaceLimitSetterGetter(): void
50
    {
51
        $this->assertEquals(-50, $this->fixture->getFontSpaceLimit());
52
53
        $this->fixture->setFontSpaceLimit(1);
54
        $this->assertEquals(1, $this->fixture->getFontSpaceLimit());
55
    }
56
57
    /**
58
     * Tests setter and getter for horizontal offset.
59
     */
60
    public function testHorizontalOffsetSetterGetter()
61
    {
62
        $this->assertEquals(' ', $this->fixture->getHorizontalOffset());
63
64
        $this->fixture->setHorizontalOffset('	');
65
        $this->assertEquals('	', $this->fixture->getHorizontalOffset());
66
    }
67
68
    /**
69
     * Tests setter and getter for retaining of raw image data.
70
     */
71
    public function testRetainImageContentSetterGetter(): void
72
    {
73
        $this->assertTrue($this->fixture->getRetainImageContent());
74
75
        $this->fixture->setRetainImageContent(false);
76
        $this->assertFalse($this->fixture->getRetainImageContent());
77
    }
78
}
79