Passed
Pull Request — master (#103)
by Alexander
03:37
created
Tests/Functional/Api/OaiPmhTest.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
     {
38 38
         parent::setUp();
39 39
 
40
-        $this->oaiUrl = $this->baseUrl . '/index.php?id=' . $this->oaiPage;
41
-        $this->oaiUrlNoStoragePid = $this->baseUrl . '/index.php?id=' . $this->oaiPageNoStoragePid;
40
+        $this->oaiUrl = $this->baseUrl.'/index.php?id='.$this->oaiPage;
41
+        $this->oaiUrlNoStoragePid = $this->baseUrl.'/index.php?id='.$this->oaiPageNoStoragePid;
42 42
 
43
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.xml');
44
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/metadata.xml');
45
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml');
46
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/pages.xml');
47
-        $this->importDataSet(__DIR__ . '/../../Fixtures/OaiPmh/pages.xml');
48
-        $this->importDataSet(__DIR__ . '/../../Fixtures/OaiPmh/solrcores.xml');
43
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/documents_1.xml');
44
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/metadata.xml');
45
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/libraries.xml');
46
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/pages.xml');
47
+        $this->importDataSet(__DIR__.'/../../Fixtures/OaiPmh/pages.xml');
48
+        $this->importDataSet(__DIR__.'/../../Fixtures/OaiPmh/solrcores.xml');
49 49
 
50 50
         $this->persistenceManager = $this->objectManager->get(PersistenceManager::class);
51 51
         $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, 20000);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             $coreName = Solr::createCore();
63 63
             $solr = Solr::getInstance($coreName);
64 64
 
65
-            $this->importSolrDocuments($solr, __DIR__ . '/../../Fixtures/Common/documents_1.solr.json');
65
+            $this->importSolrDocuments($solr, __DIR__.'/../../Fixtures/Common/documents_1.solr.json');
66 66
         }
67 67
 
68 68
         $oaiCoreModel = $this->solrCoreRepository->findByUid(11001);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $jsonDocuments = json_decode(file_get_contents($path), true);
77 77
 
78 78
         $updateQuery = $solr->service->createUpdate();
79
-        $documents = array_map(function ($jsonDoc) use ($updateQuery) {
79
+        $documents = array_map(function($jsonDoc) use ($updateQuery) {
80 80
             $document = $updateQuery->createDocument();
81 81
             foreach ($jsonDoc as $key => $value) {
82 82
                 $document->setField($key, $value);
Please login to merge, or discard this patch.
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
12 12
 use SimpleXMLElement;
13 13
 use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
14 14
 
15
-class OaiPmhTest extends FunctionalTestCase
16
-{
15
+class OaiPmhTest extends FunctionalTestCase {
17 16
     protected $disableJsonWrappedResponse = true;
18 17
 
19 18
     protected $coreExtensionsToLoad = [
@@ -53,8 +52,7 @@  discard block
 block discarded – undo
53 52
         $this->setUpOaiSolr();
54 53
     }
55 54
 
56
-    protected function setUpOaiSolr()
57
-    {
55
+    protected function setUpOaiSolr() {
58 56
         // Setup Solr only once for all tests in this suite
59 57
         static $solr = null;
60 58
 
@@ -71,8 +69,7 @@  discard block
 block discarded – undo
71 69
         $this->persistenceManager->persistAll();
72 70
     }
73 71
 
74
-    protected function importSolrDocuments(Solr $solr, string $path)
75
-    {
72
+    protected function importSolrDocuments(Solr $solr, string $path) {
76 73
         $jsonDocuments = json_decode(file_get_contents($path), true);
77 74
 
78 75
         $updateQuery = $solr->service->createUpdate();
@@ -91,8 +88,7 @@  discard block
 block discarded – undo
91 88
     /**
92 89
      * @test
93 90
      */
94
-    public function correctlyRespondsOnBadVerb()
95
-    {
91
+    public function correctlyRespondsOnBadVerb() {
96 92
         $client = new HttpClient();
97 93
         $response = $client->get($this->baseUrl, [
98 94
             'query' => [
@@ -117,8 +113,7 @@  discard block
 block discarded – undo
117 113
     /**
118 114
      * @test
119 115
      */
120
-    public function canIdentify()
121
-    {
116
+    public function canIdentify() {
122 117
         $oai = Endpoint::build($this->oaiUrl);
123 118
         $identity = $oai->identify();
124 119
 
@@ -131,8 +126,7 @@  discard block
 block discarded – undo
131 126
     /**
132 127
      * @test
133 128
      */
134
-    public function identifyGivesFallbackDatestampWhenNoDocuments()
135
-    {
129
+    public function identifyGivesFallbackDatestampWhenNoDocuments() {
136 130
         $oai = Endpoint::build($this->oaiUrlNoStoragePid);
137 131
         $identity = $oai->identify();
138 132
 
@@ -142,8 +136,7 @@  discard block
 block discarded – undo
142 136
     /**
143 137
      * @test
144 138
      */
145
-    public function canListMetadataFormats()
146
-    {
139
+    public function canListMetadataFormats() {
147 140
         $oai = Endpoint::build($this->oaiUrl);
148 141
         $formats = $oai->listMetadataFormats();
149 142
 
@@ -158,8 +151,7 @@  discard block
 block discarded – undo
158 151
     /**
159 152
      * @test
160 153
      */
161
-    public function canListRecords()
162
-    {
154
+    public function canListRecords() {
163 155
         $oai = Endpoint::build($this->oaiUrl);
164 156
         $result = $oai->listRecords('mets');
165 157
 
@@ -172,8 +164,7 @@  discard block
 block discarded – undo
172 164
     /**
173 165
      * @test
174 166
      */
175
-    public function noRecordsUntil1900()
176
-    {
167
+    public function noRecordsUntil1900() {
177 168
         $this->expectException(OaipmhException::class);
178 169
         $this->expectExceptionMessage('empty list');
179 170
 
@@ -186,8 +177,7 @@  discard block
 block discarded – undo
186 177
     /**
187 178
      * @test
188 179
      */
189
-    public function canUseResumptionToken()
190
-    {
180
+    public function canUseResumptionToken() {
191 181
         // NOTE: cursor and expirationDate are optional by the specification,
192 182
         //       but we include them in our implementation
193 183
 
@@ -245,8 +235,7 @@  discard block
 block discarded – undo
245 235
     /**
246 236
      * @test
247 237
      */
248
-    public function noResumptionTokenForCompleteList()
249
-    {
238
+    public function noResumptionTokenForCompleteList() {
250 239
         $client = new HttpClient();
251 240
 
252 241
         foreach (['ListIdentifiers', 'ListRecords'] as $verb) {
@@ -268,8 +257,7 @@  discard block
 block discarded – undo
268 257
     /**
269 258
      * @test
270 259
      */
271
-    public function canListAndResumeIdentifiers()
272
-    {
260
+    public function canListAndResumeIdentifiers() {
273 261
         $oai = Endpoint::build($this->oaiUrl);
274 262
         $result = $oai->listIdentifiers('mets');
275 263
 
@@ -282,18 +270,15 @@  discard block
 block discarded – undo
282 270
         $this->assertEquals('oai:de:slub-dresden:db:id-476248086', $record->identifier);
283 271
     }
284 272
 
285
-    protected function parseUtc(string $dateTime)
286
-    {
273
+    protected function parseUtc(string $dateTime) {
287 274
         return DateTime::createFromFormat('Y-m-d\TH:i:s\Z', $dateTime);
288 275
     }
289 276
 
290
-    protected function assertUtcDateString(string $dateTime)
291
-    {
277
+    protected function assertUtcDateString(string $dateTime) {
292 278
         $this->assertInstanceOf(DateTime::class, $this->parseUtc($dateTime));
293 279
     }
294 280
 
295
-    protected function assertInFuture(string $dateTime)
296
-    {
281
+    protected function assertInFuture(string $dateTime) {
297 282
         $this->assertGreaterThan(new DateTime(), $this->parseUtc($dateTime));
298 283
     }
299 284
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 class OaiPmhTest extends FunctionalTestCase
16 16
 {
17
-    protected $disableJsonWrappedResponse = true;
17
+    protected $disableJsonWrappedResponse = TRUE;
18 18
 
19 19
     protected $coreExtensionsToLoad = [
20 20
         'fluid',
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
     protected function setUpOaiSolr()
57 57
     {
58 58
         // Setup Solr only once for all tests in this suite
59
-        static $solr = null;
59
+        static $solr = NULL;
60 60
 
61
-        if ($solr === null) {
61
+        if ($solr === NULL) {
62 62
             $coreName = Solr::createCore();
63 63
             $solr = Solr::getInstance($coreName);
64 64
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
     protected function importSolrDocuments(Solr $solr, string $path)
75 75
     {
76
-        $jsonDocuments = json_decode(file_get_contents($path), true);
76
+        $jsonDocuments = json_decode(file_get_contents($path), TRUE);
77 77
 
78 78
         $updateQuery = $solr->service->createUpdate();
79 79
         $documents = array_map(function ($jsonDoc) use ($updateQuery) {
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         $this->expectExceptionMessage('empty list');
179 179
 
180 180
         $oai = Endpoint::build($this->oaiUrl);
181
-        $result = $oai->listRecords('mets', null, (new DateTime())->setDate(1900, 1, 1));
181
+        $result = $oai->listRecords('mets', NULL, (new DateTime())->setDate(1900, 1, 1));
182 182
 
183 183
         $result->current();
184 184
     }
Please login to merge, or discard this patch.
Tests/Functional/Repository/DocumentRepositoryTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
 
22 22
         $this->documentRepository = $this->initializeRepository(DocumentRepository::class, 20000);
23 23
 
24
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.xml');
25
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/pages.xml');
26
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml');
24
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/documents_1.xml');
25
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/pages.xml');
26
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/libraries.xml');
27 27
     }
28 28
 
29 29
     /**
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
 use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
9 9
 use TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage;
10 10
 
11
-class DocumentRepositoryTest extends FunctionalTestCase
12
-{
11
+class DocumentRepositoryTest extends FunctionalTestCase {
13 12
     /**
14 13
      * @var DocumentRepository
15 14
      */
Please login to merge, or discard this patch.
Tests/Functional/Common/SolrIndexingTest.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@
 block discarded – undo
37 37
         $this->documentRepository = $this->initializeRepository(DocumentRepository::class, 20000);
38 38
         $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, 20000);
39 39
 
40
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.xml');
41
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml');
42
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/metadata.xml');
40
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/documents_1.xml');
41
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/libraries.xml');
42
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/metadata.xml');
43 43
     }
44 44
 
45 45
     /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
 use TYPO3\CMS\Extbase\Object\ObjectManager;
15 15
 use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
16 16
 
17
-class SolrIndexingTest extends FunctionalTestCase
18
-{
17
+class SolrIndexingTest extends FunctionalTestCase {
19 18
     /** @var PersistenceManager */
20 19
     protected $persistenceManager;
21 20
 
@@ -45,8 +44,7 @@  discard block
 block discarded – undo
45 44
     /**
46 45
      * @test
47 46
      */
48
-    public function canCreateCore()
49
-    {
47
+    public function canCreateCore() {
50 48
         $coreName = uniqid('testCore');
51 49
         $solr = Solr::getInstance($coreName);
52 50
         $this->assertNull($solr->core);
@@ -61,8 +59,7 @@  discard block
 block discarded – undo
61 59
     /**
62 60
      * @test
63 61
      */
64
-    public function canIndexAndSearchDocument()
65
-    {
62
+    public function canIndexAndSearchDocument() {
66 63
         $core = $this->createSolrCore();
67 64
 
68 65
         $document = $this->documentRepository->findByUid(1001);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,16 +80,16 @@
 block discarded – undo
80 80
             'storagePid' => $document->getPid(),
81 81
         ];
82 82
 
83
-        $result = $this->documentRepository->findSolrByCollection(null, $solrSettings, ['query' => '*']);
83
+        $result = $this->documentRepository->findSolrByCollection(NULL, $solrSettings, ['query' => '*']);
84 84
         $this->assertEquals(1, $result['numberOfToplevels']);
85 85
         $this->assertEquals(15, count($result['solrResults']['documents']));
86 86
 
87 87
         // Check that the title stored in Solr matches the title of database entry
88
-        $docTitleInSolr = false;
88
+        $docTitleInSolr = FALSE;
89 89
         foreach ($result['solrResults']['documents'] as $solrDoc) {
90 90
             if ($solrDoc['toplevel'] && $solrDoc['uid'] === $document->getUid()) {
91 91
                 $this->assertEquals($document->getTitle(), $solrDoc['title']);
92
-                $docTitleInSolr = true;
92
+                $docTitleInSolr = TRUE;
93 93
                 break;
94 94
             }
95 95
         }
Please login to merge, or discard this patch.