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
06:09 queued 02:52
created

ModsTest::extractYearsWithElectronicEdInside()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 22
rs 9.8666
1
<?php
2
3
namespace Kitodo\Dlf\Tests\Unit\Format;
4
5
use Kitodo\Dlf\Format\Mods;
6
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
7
8
class ModsTest extends UnitTestCase
9
{
10
    protected $metadata = [];
11
12
    public function setUp(): void
13
    {
14
        parent::setUp();
15
16
        $this->metadata = [
17
            'title' => [],
18
            'title_sorting' => [],
19
            'author' => [],
20
            'place' => [],
21
            'place_sorting' => [0 => []],
22
            'year' => [],
23
            'prod_id' => [],
24
            'record_id' => [],
25
            'opac_id' => [],
26
            'union_id' => [],
27
            'urn' => [],
28
            'purl' => [],
29
            'type' => [],
30
            'volume' => [],
31
            'volume_sorting' => [],
32
            'license' => [],
33
            'terms' => [],
34
            'restrictions' => [],
35
            'out_of_print' => [],
36
            'rights_info' => [],
37
            'collection' => [],
38
            'owner' => [],
39
            'mets_label' => [],
40
            'mets_orderlabel' => [],
41
            'document_format' => ['METS'],
42
            'year_sorting' => [0 => []],
43
        ];
44
45
    }
46
47
    /**
48
     * @test
49
     * @group extractMetadata
50
     */
51
    public function extractAuthorsIfNoAutRoleTermAssigned(): void
52
    {
53
        $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsAuthorNoAutRoleTerm.xml');
54
        $mods = new Mods();
55
56
        $mods->extractMetadata($xml,$this->metadata);
57
58
        $this->assertEquals(
59
            [
60
                "AnonymousGiven1 AnonymousFamily1",
61
                "AnonymousFamily2, AnonymousGiven2"
62
            ],
63
            $this->metadata['author']
64
        );
65
    }
66
67
    /**
68
     * @test
69
     * @group extractMetadata
70
     */
71
    public function extractAuthorsWithAutRoleTermAssigned(): void
72
    {
73
        $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsAuthorWithAutRoleTerm.xml');
74
        $mods = new Mods();
75
76
        $mods->extractMetadata($xml,$this->metadata);
77
        $this->assertEquals(
78
            [
79
                'May, Jack, I',
80
                'John Paul, Pope, 1920-2005',
81
                'Mattox, Douglas E., 1947-',
82
                '1882-1941, Woolf, Virginia',
83
                'Eric Alterman'
84
            ],
85
            $this->metadata['author']
86
        );
87
    }
88
89
    /**
90
     * @test
91
     * @group extractMetadata
92
     */
93
    public function extractPlaces(): void
94
    {
95
        $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsOriginInfo.xml');
96
        $mods = new Mods();
97
98
        $mods->extractMetadata($xml,$this->metadata);
99
100
        $this->assertEquals(
101
            [
102
                "Dresden",
103
                "Hamburg",
104
                "Berlin",
105
                "München",
106
            ],
107
            $this->metadata['place']
108
        );
109
110
        $this->assertEquals(
111
            [
112
                "Dresden",
113
            ],
114
            $this->metadata['place_sorting']
115
        );
116
    }
117
118
    /**
119
     * @test
120
     * @group extractMetadata
121
     */
122
    public function extractYears(): void
123
    {
124
        $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsOriginInfo.xml');
125
        $mods = new Mods();
126
127
        $mods->extractMetadata($xml,$this->metadata);
128
129
        $this->assertEquals(
130
            [
131
                "2019",
132
                "2018",
133
                "2021",
134
                "2020",
135
            ],
136
            $this->metadata['year']
137
        );
138
139
        $this->assertEquals(
140
            [
141
                "2019",
142
            ],
143
            $this->metadata['year_sorting']
144
        );
145
    }
146
147
    /**
148
     * @test
149
     * @group extractMetadata
150
     */
151
    public function extractPlacesWithElectronicEdInside(): void
152
    {
153
        $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsOriginInfoWithEditionElectonicEd.xml');
154
        $mods = new Mods();
155
156
        $mods->extractMetadata($xml,$this->metadata);
157
158
        $this->assertEquals(
159
            [
160
                "Dresden",
161
                "Hamburg",
162
                "Berlin",
163
                "München",
164
            ],
165
            $this->metadata['place']
166
        );
167
168
        $this->assertEquals(
169
            [
170
                "Dresden",
171
            ],
172
            $this->metadata['place_sorting']
173
        );
174
    }
175
176
    /**
177
     * @test
178
     * @group extractMetadata
179
     */
180
    public function extractYearsWithElectronicEdInside(): void
181
    {
182
        $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsOriginInfoWithEditionElectonicEd.xml');
183
        $mods = new Mods();
184
185
        $mods->extractMetadata($xml,$this->metadata);
186
187
        $this->assertEquals(
188
            [
189
                "2019",
190
                "2018",
191
                "2021",
192
                "2020",
193
            ],
194
            $this->metadata['year']
195
        );
196
197
        $this->assertEquals(
198
            [
199
                "2019",
200
            ],
201
            $this->metadata['year_sorting']
202
        );
203
    }
204
}
205