Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

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.
Passed
Pull Request — master (#894)
by
unknown
19:12 queued 14:16
created

AltoTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 46
c 1
b 0
f 0
dl 0
loc 96
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getTextAsMiniOcr() 0 32 1
A getTextAsMiniOcrNoTextline() 0 8 1
A getTextAsMiniOcrNoTextBlock() 0 8 1
A getTextAsMiniOcrNoString() 0 10 1
A getRawData() 0 8 1
1
<?php
2
3
namespace Kitodo\Dlf\Tests\Unit\Format;
4
5
use Kitodo\Dlf\Format\Alto;
6
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
7
8
class AltoTest extends UnitTestCase
9
{
10
    /**
11
     * @test
12
     * @group extract data
13
     */
14
    public function getRawData(): void
15
    {
16
        $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/alto.xml');
17
        $alto = new Alto();
18
19
        $rawText = $alto->getRawText($xml);
20
21
        $this->assertEquals('Bürgertum und Bürgerlichkeit in Dresden DRESDNER HEFTE', $rawText);
22
    }
23
24
    /**
25
     * @test
26
     * @group extract data
27
     */
28
    public function getTextAsMiniOcr(): void
29
    {
30
        $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/alto.xml');
31
        $alto = new Alto();
32
33
        $rawText = $alto->getTextAsMiniOcr($xml);
34
35
        $miniOCR = <<<XML
36
        <ocr>
37
            <b>
38
                <l>
39
                    <w x="477 2083 437 95">B&#xFC;rgertum </w>
40
                    <w x="950 2076 155 76">und </w>
41
                </l>
42
                <l>
43
                    <w x="477 2201 574 102">B&#xFC;rgerlichkeit </w>
44
                    <w x="1084 2205 74 68">in </w>
45
                    <w x="1194 2199 333 75">Dresden </w>
46
                </l>
47
            </b>
48
            <b>
49
                <l>
50
                    <w x="473 315 752 98">DRESDNER </w>
51
                </l>
52
                <l>
53
                    <w x="473 492 448 97">HEFTE </w>
54
                </l>
55
            </b>
56
        </ocr>
57
        XML;
58
59
        $this->assertXmlStringEqualsXmlString($miniOCR, $rawText);
60
    }
61
62
    /**
63
     * @test
64
     * @group extract data
65
     */
66
    public function getTextAsMiniOcrNoTextBlock(): void
67
    {
68
        $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/altoNoTextBlock.xml');
69
        $alto = new Alto();
70
71
        $rawText = $alto->getTextAsMiniOcr($xml);
72
73
        $this->assertEquals('', $rawText);
74
    }
75
76
    /**
77
     * @test
78
     * @group extract data
79
     */
80
    public function getTextAsMiniOcrNoTextline(): void
81
    {
82
        $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/altoNoTextLine.xml');
83
        $alto = new Alto();
84
85
        $rawText = $alto->getTextAsMiniOcr($xml);
86
87
        $this->assertXmlStringEqualsXmlString('<?xml version="1.0"?><ocr><b/><b/></ocr>', $rawText);
88
    }
89
90
    /**
91
     * @test
92
     * @group extract data
93
     */
94
    public function getTextAsMiniOcrNoString(): void
95
    {
96
        $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/altoNoString.xml');
97
        $alto = new Alto();
98
99
        $rawText = $alto->getTextAsMiniOcr($xml);
100
101
        $this->assertXmlStringEqualsXmlString(
102
            '<?xml version="1.0"?><ocr><b><l/><l/></b><b><l/><l/></b></ocr>',
103
            $rawText
104
        );
105
    }
106
}
107