Passed
Pull Request — master (#123)
by
unknown
04:33
created
Tests/Functional/Common/SolrTest.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
 use Kitodo\Dlf\Domain\Repository\SolrCoreRepository;
18 18
 use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
19 19
 
20
-class SolrTest extends FunctionalTestCase
21
-{
20
+class SolrTest extends FunctionalTestCase {
22 21
 
23 22
     private static array $databaseFixtures = [
24 23
         __DIR__ . '/../../Fixtures/Common/documents_1.csv',
@@ -33,8 +32,7 @@  discard block
 block discarded – undo
33 32
     /**
34 33
      * @test
35 34
      */
36
-    public function canCreateCore()
37
-    {
35
+    public function canCreateCore() {
38 36
         $this->assertEquals('newCoreName', Solr::createCore('newCoreName'));
39 37
         $this->assertEquals('newCoreName', Solr::getInstance('newCoreName')->core);
40 38
     }
@@ -42,8 +40,7 @@  discard block
 block discarded – undo
42 40
     /**
43 41
      * @test
44 42
      */
45
-    public function canEscapeQuery()
46
-    {
43
+    public function canEscapeQuery() {
47 44
         $query1 = Solr::escapeQuery('"custom query with special characters: "testvalue"\n"');
48 45
         $this->assertEquals('"custom query with special characters\: "testvalue"\\\\n"', $query1);
49 46
 
@@ -54,8 +51,7 @@  discard block
 block discarded – undo
54 51
     /**
55 52
      * @test
56 53
      */
57
-    public function canEscapeQueryKeepField()
58
-    {
54
+    public function canEscapeQueryKeepField() {
59 55
         $query1 = Solr::escapeQueryKeepField('abc_uui:(abc)', 0);
60 56
         $this->assertEquals('abc_uui\:(abc)', $query1);
61 57
     }
@@ -63,8 +59,7 @@  discard block
 block discarded – undo
63 59
     /**
64 60
      * @test
65 61
      */
66
-    public function canGetNextCoreNumber()
67
-    {
62
+    public function canGetNextCoreNumber() {
68 63
         $this->assertEquals(5, Solr::getNextCoreNumber());
69 64
         $this->assertEquals(5, Solr::getNextCoreNumber());
70 65
         Solr::createCore();
@@ -74,8 +69,7 @@  discard block
 block discarded – undo
74 69
     /**
75 70
      * @test
76 71
      */
77
-    public function canSearchRaw()
78
-    {
72
+    public function canSearchRaw() {
79 73
         $this->setUpData(self::$databaseFixtures);
80 74
         $solr = $this->setUpSolr(4, 0, self::$solrFixtures);
81 75
         $resultSet = $solr->searchRaw(['core' => 4, 'collection' => 1]);
@@ -92,8 +86,7 @@  discard block
 block discarded – undo
92 86
         $this->initializeRepository(DocumentRepository::class, 0);
93 87
     }
94 88
 
95
-    protected function setUpSolr($uid, $storagePid, $solrFixtures)
96
-    {
89
+    protected function setUpSolr($uid, $storagePid, $solrFixtures) {
97 90
         $solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, $storagePid);
98 91
 
99 92
         // Setup Solr only once for all tests in this suite
Please login to merge, or discard this patch.
Tests/Functional/FunctionalTestCase.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -91,8 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     protected $httpClient;
93 93
 
94
-    public function __construct()
95
-    {
94
+    public function __construct() {
96 95
         parent::__construct();
97 96
 
98 97
         $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration();
@@ -120,8 +119,7 @@  discard block
 block discarded – undo
120 119
         $this->addSiteConfig('dlf-testing');
121 120
     }
122 121
 
123
-    protected function getDlfConfiguration()
124
-    {
122
+    protected function getDlfConfiguration() {
125 123
         $dotenv = Dotenv::createImmutable('/home/runner/work/kitodo-presentation/kitodo-presentation/Build/Test/', 'test.env');
126 124
         $dotenv->load();
127 125
 
@@ -162,8 +160,7 @@  discard block
 block discarded – undo
162 160
         ];
163 161
     }
164 162
 
165
-    protected function addSiteConfig($identifier)
166
-    {
163
+    protected function addSiteConfig($identifier) {
167 164
         $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml');
168 165
         $siteConfig['base'] = $this->baseUrl;
169 166
         $siteConfig['languages'][0]['base'] = $this->baseUrl;
@@ -173,8 +170,7 @@  discard block
 block discarded – undo
173 170
         file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig));
174 171
     }
175 172
 
176
-    protected function initializeRepository(string $className, int $storagePid)
177
-    {
173
+    protected function initializeRepository(string $className, int $storagePid) {
178 174
         $repository = $this->objectManager->get($className);
179 175
 
180 176
         $querySettings = $this->objectManager->get(Typo3QuerySettings::class);
@@ -184,8 +180,7 @@  discard block
 block discarded – undo
184 180
         return $repository;
185 181
     }
186 182
 
187
-    protected function importSolrDocuments(Solr $solr, string $path)
188
-    {
183
+    protected function importSolrDocuments(Solr $solr, string $path) {
189 184
         $jsonDocuments = json_decode(file_get_contents($path), true);
190 185
 
191 186
         $updateQuery = $solr->service->createUpdate();
@@ -204,16 +199,14 @@  discard block
 block discarded – undo
204 199
         $solr->service->update($updateQuery);
205 200
     }
206 201
 
207
-    protected function initLanguageService(string $locale)
208
-    {
202
+    protected function initLanguageService(string $locale) {
209 203
         $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->create($locale);
210 204
     }
211 205
 
212 206
     /**
213 207
      * Assert that $sub is recursively contained within $super.
214 208
      */
215
-    protected function assertArrayMatches(array $sub, array $super, string $message = '')
216
-    {
209
+    protected function assertArrayMatches(array $sub, array $super, string $message = '') {
217 210
         self::assertEquals($sub, ArrayUtility::intersectRecursive($super, $sub), $message);
218 211
     }
219 212
 }
Please login to merge, or discard this patch.
Classes/Command/DeleteCommand.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@
 block discarded – undo
31 31
  *
32 32
  * @access public
33 33
  */
34
-class DeleteCommand extends BaseCommand
35
-{
34
+class DeleteCommand extends BaseCommand {
36 35
 
37 36
     /**
38 37
      * Configure the command by defining the name, options and arguments
Please login to merge, or discard this patch.
Classes/Common/IiifManifest.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@  discard block
 block discarded – undo
75 75
  * @property array $mimeTypes this holds the mime types of linked resources in the manifest (extracted during parsing) for later us
76 76
  * 
77 77
  */
78
-final class IiifManifest extends AbstractDocument
79
-{
78
+final class IiifManifest extends AbstractDocument {
80 79
     /**
81 80
      * @access protected
82 81
      * @var string This holds the manifest file as string for serialization purposes
@@ -229,8 +228,7 @@  discard block
 block discarded – undo
229 228
      *
230 229
      * @return array|string
231 230
      */
232
-    protected function getUseGroups(string $use)
233
-    {
231
+    protected function getUseGroups(string $use) {
234 232
         if (!$this->useGrpsLoaded) {
235 233
             // Get configured USE attributes.
236 234
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files');
Please login to merge, or discard this patch.
Classes/Eid/PageViewProxy.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
  *
35 35
  * @access public
36 36
  */
37
-class PageViewProxy
38
-{
37
+class PageViewProxy {
39 38
     /**
40 39
      * @access protected
41 40
      * @var RequestFactory
@@ -55,8 +54,7 @@  discard block
 block discarded – undo
55 54
      *
56 55
      * @return void
57 56
      */
58
-    public function __construct()
59
-    {
57
+    public function __construct() {
60 58
         $this->requestFactory = GeneralUtility::makeInstance(RequestFactory::class);
61 59
         $this->extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf', 'general');
62 60
     }
Please login to merge, or discard this patch.
Tests/Functional/Api/PageViewProxyTest.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,12 +15,10 @@  discard block
 block discarded – undo
15 15
 use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
16 16
 use TYPO3\CMS\Core\Utility\GeneralUtility;
17 17
 
18
-class PageViewProxyTest extends FunctionalTestCase
19
-{
18
+class PageViewProxyTest extends FunctionalTestCase {
20 19
     protected $disableJsonWrappedResponse = true;
21 20
 
22
-    protected function getDlfConfiguration()
23
-    {
21
+    protected function getDlfConfiguration() {
24 22
         return array_merge(parent::getDlfConfiguration(), [
25 23
             'general' => [
26 24
                 'enableInternalProxy' => true
@@ -28,8 +26,7 @@  discard block
 block discarded – undo
28 26
         ]);
29 27
     }
30 28
 
31
-    protected function queryProxy(array $query, string $method = 'GET')
32
-    {
29
+    protected function queryProxy(array $query, string $method = 'GET') {
33 30
         $query['eID'] = 'tx_dlf_pageview_proxy';
34 31
 
35 32
         return $this->httpClient->request($method, '', [
Please login to merge, or discard this patch.
Tests/Functional/Common/MetsDocumentTest.php 1 patch
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@  discard block
 block discarded – undo
15 15
 use Kitodo\Dlf\Common\AbstractDocument;
16 16
 use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
17 17
 
18
-class MetsDocumentTest extends FunctionalTestCase
19
-{
18
+class MetsDocumentTest extends FunctionalTestCase {
20 19
     public function setUp(): void
21 20
     {
22 21
         parent::setUp();
@@ -26,8 +25,7 @@  discard block
 block discarded – undo
26 25
         $this->importCSVDataSet(__DIR__ . '/../../Fixtures/MetsDocument/metadata_mets.csv');
27 26
     }
28 27
 
29
-    protected function doc(string $file)
30
-    {
28
+    protected function doc(string $file) {
31 29
         $url = 'http://web:8001/Tests/Fixtures/MetsDocument/' . $file;
32 30
         $doc = AbstractDocument::getInstance($url, ['general' => ['useExternalApisForMetadata' => 0]]);
33 31
         self::assertNotNull($doc);
@@ -37,8 +35,7 @@  discard block
 block discarded – undo
37 35
     /**
38 36
      * @test
39 37
      */
40
-    public function canParseDmdAndAmdSec()
41
-    {
38
+    public function canParseDmdAndAmdSec() {
42 39
         $doc = $this->doc('av_beispiel.xml');
43 40
 
44 41
         $toplevelMetadata = $doc->getToplevelMetadata(20000);
@@ -56,8 +53,7 @@  discard block
 block discarded – undo
56 53
     /**
57 54
      * @test
58 55
      */
59
-    public function canReadFileMetadata()
60
-    {
56
+    public function canReadFileMetadata() {
61 57
         $doc = $this->doc('av_beispiel.xml');
62 58
 
63 59
         $thumbsMeta = $doc->getMetadata('FILE_0000_THUMBS', 20000);
@@ -72,8 +68,7 @@  discard block
 block discarded – undo
72 68
     /**
73 69
      * @test
74 70
      */
75
-    public function canGetLogicalStructure()
76
-    {
71
+    public function canGetLogicalStructure() {
77 72
         $doc = $this->doc('av_beispiel.xml');
78 73
 
79 74
         $toc = $doc->tableOfContents[0] ?? [];
@@ -109,8 +104,7 @@  discard block
 block discarded – undo
109 104
     /**
110 105
      * @test
111 106
      */
112
-    public function doesNotOverwriteFirstDmdSec()
113
-    {
107
+    public function doesNotOverwriteFirstDmdSec() {
114 108
         $doc = $this->doc('two_dmdsec.xml');
115 109
 
116 110
         $toplevelMetadata = $doc->getToplevelMetadata(20000);
@@ -123,8 +117,7 @@  discard block
 block discarded – undo
123 117
     /**
124 118
      * @test
125 119
      */
126
-    public function returnsEmptyMetadataWhenNoDmdSec()
127
-    {
120
+    public function returnsEmptyMetadataWhenNoDmdSec() {
128 121
         $doc = $this->doc('two_dmdsec.xml');
129 122
 
130 123
         // DMD and AMD works
@@ -143,8 +136,7 @@  discard block
 block discarded – undo
143 136
     /**
144 137
      * @test
145 138
      */
146
-    public function canGetDownloadLocation()
147
-    {
139
+    public function canGetDownloadLocation() {
148 140
         $doc = $this->doc('two_dmdsec.xml');
149 141
 
150 142
         $correct = $doc->getDownloadLocation('FILE_0000_DOWNLOAD');
@@ -162,8 +154,7 @@  discard block
 block discarded – undo
162 154
     /**
163 155
      * @test
164 156
      */
165
-    public function canGetFileLocation()
166
-    {
157
+    public function canGetFileLocation() {
167 158
         $doc = $this->doc('two_dmdsec.xml');
168 159
 
169 160
         $correct = $doc->getFileLocation('FILE_0000_DEFAULT');
@@ -176,8 +167,7 @@  discard block
 block discarded – undo
176 167
     /**
177 168
      * @test
178 169
      */
179
-    public function canGetFileMimeType()
180
-    {
170
+    public function canGetFileMimeType() {
181 171
         $doc = $this->doc('two_dmdsec.xml');
182 172
 
183 173
         $correct = $doc->getFileMimeType('FILE_0000_DEFAULT');
@@ -191,8 +181,7 @@  discard block
 block discarded – undo
191 181
     /**
192 182
      * @test
193 183
      */
194
-    public function canGetPhysicalPage()
195
-    {
184
+    public function canGetPhysicalPage() {
196 185
         $doc = $this->doc('mets_with_pages.xml');
197 186
 
198 187
         // pass orderlabel and retrieve order
@@ -203,8 +192,7 @@  discard block
 block discarded – undo
203 192
     /**
204 193
      * @test
205 194
      */
206
-    public function canGetTitle()
207
-    {
195
+    public function canGetTitle() {
208 196
         $doc = $this->doc('mets_with_pages.xml');
209 197
 
210 198
         $correct = $doc->getTitle(1001);
@@ -217,8 +205,7 @@  discard block
 block discarded – undo
217 205
     /**
218 206
      * @test
219 207
      */
220
-    public function canGetFullText()
221
-    {
208
+    public function canGetFullText() {
222 209
         $doc = $this->doc('mets_with_pages.xml');
223 210
 
224 211
         $fulltext = $doc->getFullText('PHYS_0003');
@@ -234,8 +221,7 @@  discard block
 block discarded – undo
234 221
     /**
235 222
      * @test
236 223
      */
237
-    public function canGetStructureDepth()
238
-    {
224
+    public function canGetStructureDepth() {
239 225
         $doc = $this->doc('mets_with_pages.xml');
240 226
 
241 227
         $correct = $doc->getStructureDepth('LOG_0001');
Please login to merge, or discard this patch.
Classes/Validation/DocumentValidator.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @access public
29 29
  */
30
-class DocumentValidator
31
-{
30
+class DocumentValidator {
32 31
      /**
33 32
      * @access protected
34 33
      * @var Logger This holds the logger
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
      *
64 63
      * @return void
65 64
      */
66
-    public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = null)
67
-    {
65
+    public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = null) {
68 66
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
69 67
         $this->metadata = $metadata;
70 68
         $this->requiredMetadataFields = $requiredMetadataFields;
Please login to merge, or discard this patch.
Tests/Unit/Validation/DocumentValidatorTest.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@  discard block
 block discarded – undo
15 15
 use SimpleXMLElement;
16 16
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
17 17
 
18
-class DocumentValidatorTest extends UnitTestCase
19
-{
18
+class DocumentValidatorTest extends UnitTestCase {
20 19
     public function setUp(): void
21 20
     {
22 21
         parent::setUp();
@@ -27,8 +26,7 @@  discard block
 block discarded – undo
27 26
     /**
28 27
      * @test
29 28
      */
30
-    public function passesHasAllMandatoryMetadataFields()
31
-    {
29
+    public function passesHasAllMandatoryMetadataFields() {
32 30
         $metadata = [
33 31
             'record_id' => [
34 32
                 'xyz'
@@ -41,8 +39,7 @@  discard block
 block discarded – undo
41 39
     /**
42 40
      * @test
43 41
      */
44
-    public function notPassesHasAllMandatoryMetadataFields()
45
-    {
42
+    public function notPassesHasAllMandatoryMetadataFields() {
46 43
         $metadata = [
47 44
             'document_format' => [
48 45
                 'METS'
@@ -55,8 +52,7 @@  discard block
 block discarded – undo
55 52
     /**
56 53
      * @test
57 54
      */
58
-    public function passesHasCorrectLogicalStructure()
59
-    {
55
+    public function passesHasCorrectLogicalStructure() {
60 56
         $xml = $this->getXml('av_beispiel.xml');
61 57
 
62 58
         $documentValidator = new DocumentValidator([], [], $xml);
@@ -66,8 +62,7 @@  discard block
 block discarded – undo
66 62
     /**
67 63
      * @test
68 64
      */
69
-    public function notPassesHasCorrectLogicalStructure()
70
-    {
65
+    public function notPassesHasCorrectLogicalStructure() {
71 66
         $xml = $this->getXml('av_beispiel.xml');
72 67
 
73 68
         $documentValidator = new DocumentValidator([], [], $xml);
@@ -77,8 +72,7 @@  discard block
 block discarded – undo
77 72
     /**
78 73
      * @test
79 74
      */
80
-    public function passesHasCorrectPhysicalStructure()
81
-    {
75
+    public function passesHasCorrectPhysicalStructure() {
82 76
         $xml = $this->getXml('av_beispiel.xml');
83 77
 
84 78
         $documentValidator = new DocumentValidator([], [], $xml);
@@ -88,8 +82,7 @@  discard block
 block discarded – undo
88 82
     /**
89 83
      * @test
90 84
      */
91
-    public function notPassesHasCorrectPhysicalStructure()
92
-    {
85
+    public function notPassesHasCorrectPhysicalStructure() {
93 86
         $xml = $this->getXml('two_dmdsec.xml');
94 87
 
95 88
         $documentValidator = new DocumentValidator([], [], $xml);
Please login to merge, or discard this patch.