@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
| 72 | 72 | |
| 73 | 73 | if ($this->disableJsonWrappedResponse) { |
| 74 | - $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function ($ext) { |
|
| 74 | + $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function($ext) { |
|
| 75 | 75 | return $ext !== 'Resources/Core/Functional/Extensions/json_response'; |
| 76 | 76 | }); |
| 77 | 77 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
| 85 | 85 | |
| 86 | - $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/'; |
|
| 86 | + $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-'.$this->identifier.'/'; |
|
| 87 | 87 | $this->httpClient = new HttpClient([ |
| 88 | 88 | 'base_uri' => $this->baseUrl, |
| 89 | 89 | 'http_errors' => false, |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | protected function addSiteConfig($identifier, $baseUrl) |
| 129 | 129 | { |
| 130 | - $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
|
| 130 | + $siteConfig = Yaml::parseFile(__DIR__.'/../Fixtures/siteconfig.yaml'); |
|
| 131 | 131 | $siteConfig['base'] = $baseUrl; |
| 132 | 132 | $siteConfig['languages'][0]['base'] = $baseUrl; |
| 133 | 133 | |
| 134 | - $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier; |
|
| 134 | + $siteConfigPath = $this->instancePath.'/typo3conf/sites/'.$identifier; |
|
| 135 | 135 | @mkdir($siteConfigPath, 0775, true); |
| 136 | - file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
|
| 136 | + file_put_contents($siteConfigPath.'/config.yaml', Yaml::dump($siteConfig)); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | protected function initializeRepository(string $className, int $storagePid) |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $jsonDocuments = json_decode(file_get_contents($path), true); |
| 153 | 153 | |
| 154 | 154 | $updateQuery = $solr->service->createUpdate(); |
| 155 | - $documents = array_map(function ($jsonDoc) use ($updateQuery) { |
|
| 155 | + $documents = array_map(function($jsonDoc) use ($updateQuery) { |
|
| 156 | 156 | $document = $updateQuery->createDocument(); |
| 157 | 157 | foreach ($jsonDoc as $key => $value) { |
| 158 | 158 | $document->setField($key, $value); |
@@ -64,8 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | protected $httpClient; |
| 66 | 66 | |
| 67 | - public function __construct() |
|
| 68 | - { |
|
| 67 | + public function __construct() { |
|
| 69 | 68 | parent::__construct(); |
| 70 | 69 | |
| 71 | 70 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
@@ -92,8 +91,7 @@ discard block |
||
| 92 | 91 | $this->addSiteConfig('dlf-testing', $this->baseUrl); |
| 93 | 92 | } |
| 94 | 93 | |
| 95 | - protected function getDlfConfiguration() |
|
| 96 | - { |
|
| 94 | + protected function getDlfConfiguration() { |
|
| 97 | 95 | return [ |
| 98 | 96 | 'solrFieldAutocomplete' => 'autocomplete', |
| 99 | 97 | 'solrFieldCollection' => 'collection', |
@@ -125,8 +123,7 @@ discard block |
||
| 125 | 123 | ]; |
| 126 | 124 | } |
| 127 | 125 | |
| 128 | - protected function addSiteConfig($identifier, $baseUrl) |
|
| 129 | - { |
|
| 126 | + protected function addSiteConfig($identifier, $baseUrl) { |
|
| 130 | 127 | $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
| 131 | 128 | $siteConfig['base'] = $baseUrl; |
| 132 | 129 | $siteConfig['languages'][0]['base'] = $baseUrl; |
@@ -136,8 +133,7 @@ discard block |
||
| 136 | 133 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
| 137 | 134 | } |
| 138 | 135 | |
| 139 | - protected function initializeRepository(string $className, int $storagePid) |
|
| 140 | - { |
|
| 136 | + protected function initializeRepository(string $className, int $storagePid) { |
|
| 141 | 137 | $repository = $this->objectManager->get($className); |
| 142 | 138 | |
| 143 | 139 | $querySettings = $this->objectManager->get(Typo3QuerySettings::class); |
@@ -147,8 +143,7 @@ discard block |
||
| 147 | 143 | return $repository; |
| 148 | 144 | } |
| 149 | 145 | |
| 150 | - protected function importSolrDocuments(Solr $solr, string $path) |
|
| 151 | - { |
|
| 146 | + protected function importSolrDocuments(Solr $solr, string $path) { |
|
| 152 | 147 | $jsonDocuments = json_decode(file_get_contents($path), true); |
| 153 | 148 | |
| 154 | 149 | $updateQuery = $solr->service->createUpdate(); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @var bool |
| 51 | 51 | */ |
| 52 | - protected $disableJsonWrappedResponse = false; |
|
| 52 | + protected $disableJsonWrappedResponse = FALSE; |
|
| 53 | 53 | |
| 54 | 54 | /** @var ObjectManager */ |
| 55 | 55 | protected $objectManager; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/'; |
| 87 | 87 | $this->httpClient = new HttpClient([ |
| 88 | 88 | 'base_uri' => $this->baseUrl, |
| 89 | - 'http_errors' => false, |
|
| 89 | + 'http_errors' => FALSE, |
|
| 90 | 90 | ]); |
| 91 | 91 | |
| 92 | 92 | $this->addSiteConfig('dlf-testing', $this->baseUrl); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $siteConfig['languages'][0]['base'] = $baseUrl; |
| 133 | 133 | |
| 134 | 134 | $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier; |
| 135 | - @mkdir($siteConfigPath, 0775, true); |
|
| 135 | + @mkdir($siteConfigPath, 0775, TRUE); |
|
| 136 | 136 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | protected function importSolrDocuments(Solr $solr, string $path) |
| 151 | 151 | { |
| 152 | - $jsonDocuments = json_decode(file_get_contents($path), true); |
|
| 152 | + $jsonDocuments = json_decode(file_get_contents($path), TRUE); |
|
| 153 | 153 | |
| 154 | 154 | $updateQuery = $solr->service->createUpdate(); |
| 155 | 155 | $documents = array_map(function ($jsonDoc) use ($updateQuery) { |
@@ -37,15 +37,15 @@ discard block |
||
| 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 |
||
| 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); |
@@ -12,8 +12,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -74,8 +72,7 @@ discard block |
||
| 74 | 72 | /** |
| 75 | 73 | * @test |
| 76 | 74 | */ |
| 77 | - public function correctlyRespondsOnBadVerb() |
|
| 78 | - { |
|
| 75 | + public function correctlyRespondsOnBadVerb() { |
|
| 79 | 76 | $client = new HttpClient(); |
| 80 | 77 | $response = $client->get($this->baseUrl, [ |
| 81 | 78 | 'query' => [ |
@@ -100,8 +97,7 @@ discard block |
||
| 100 | 97 | /** |
| 101 | 98 | * @test |
| 102 | 99 | */ |
| 103 | - public function canIdentify() |
|
| 104 | - { |
|
| 100 | + public function canIdentify() { |
|
| 105 | 101 | $oai = Endpoint::build($this->oaiUrl); |
| 106 | 102 | $identity = $oai->identify(); |
| 107 | 103 | |
@@ -114,8 +110,7 @@ discard block |
||
| 114 | 110 | /** |
| 115 | 111 | * @test |
| 116 | 112 | */ |
| 117 | - public function identifyGivesFallbackDatestampWhenNoDocuments() |
|
| 118 | - { |
|
| 113 | + public function identifyGivesFallbackDatestampWhenNoDocuments() { |
|
| 119 | 114 | $oai = Endpoint::build($this->oaiUrlNoStoragePid); |
| 120 | 115 | $identity = $oai->identify(); |
| 121 | 116 | |
@@ -125,8 +120,7 @@ discard block |
||
| 125 | 120 | /** |
| 126 | 121 | * @test |
| 127 | 122 | */ |
| 128 | - public function canListMetadataFormats() |
|
| 129 | - { |
|
| 123 | + public function canListMetadataFormats() { |
|
| 130 | 124 | $oai = Endpoint::build($this->oaiUrl); |
| 131 | 125 | $formats = $oai->listMetadataFormats(); |
| 132 | 126 | |
@@ -141,8 +135,7 @@ discard block |
||
| 141 | 135 | /** |
| 142 | 136 | * @test |
| 143 | 137 | */ |
| 144 | - public function canListRecords() |
|
| 145 | - { |
|
| 138 | + public function canListRecords() { |
|
| 146 | 139 | $oai = Endpoint::build($this->oaiUrl); |
| 147 | 140 | $result = $oai->listRecords('mets'); |
| 148 | 141 | |
@@ -155,8 +148,7 @@ discard block |
||
| 155 | 148 | /** |
| 156 | 149 | * @test |
| 157 | 150 | */ |
| 158 | - public function noRecordsUntil1900() |
|
| 159 | - { |
|
| 151 | + public function noRecordsUntil1900() { |
|
| 160 | 152 | $this->expectException(OaipmhException::class); |
| 161 | 153 | $this->expectExceptionMessage('empty list'); |
| 162 | 154 | |
@@ -169,8 +161,7 @@ discard block |
||
| 169 | 161 | /** |
| 170 | 162 | * @test |
| 171 | 163 | */ |
| 172 | - public function canUseResumptionToken() |
|
| 173 | - { |
|
| 164 | + public function canUseResumptionToken() { |
|
| 174 | 165 | // NOTE: cursor and expirationDate are optional by the specification, |
| 175 | 166 | // but we include them in our implementation |
| 176 | 167 | |
@@ -228,8 +219,7 @@ discard block |
||
| 228 | 219 | /** |
| 229 | 220 | * @test |
| 230 | 221 | */ |
| 231 | - public function noResumptionTokenForCompleteList() |
|
| 232 | - { |
|
| 222 | + public function noResumptionTokenForCompleteList() { |
|
| 233 | 223 | $client = new HttpClient(); |
| 234 | 224 | |
| 235 | 225 | foreach (['ListIdentifiers', 'ListRecords'] as $verb) { |
@@ -251,8 +241,7 @@ discard block |
||
| 251 | 241 | /** |
| 252 | 242 | * @test |
| 253 | 243 | */ |
| 254 | - public function canListAndResumeIdentifiers() |
|
| 255 | - { |
|
| 244 | + public function canListAndResumeIdentifiers() { |
|
| 256 | 245 | $oai = Endpoint::build($this->oaiUrl); |
| 257 | 246 | $result = $oai->listIdentifiers('mets'); |
| 258 | 247 | |
@@ -265,18 +254,15 @@ discard block |
||
| 265 | 254 | $this->assertEquals('oai:de:slub-dresden:db:id-476248086', $record->identifier); |
| 266 | 255 | } |
| 267 | 256 | |
| 268 | - protected function parseUtc(string $dateTime) |
|
| 269 | - { |
|
| 257 | + protected function parseUtc(string $dateTime) { |
|
| 270 | 258 | return DateTime::createFromFormat('Y-m-d\TH:i:s\Z', $dateTime); |
| 271 | 259 | } |
| 272 | 260 | |
| 273 | - protected function assertUtcDateString(string $dateTime) |
|
| 274 | - { |
|
| 261 | + protected function assertUtcDateString(string $dateTime) { |
|
| 275 | 262 | $this->assertInstanceOf(DateTime::class, $this->parseUtc($dateTime)); |
| 276 | 263 | } |
| 277 | 264 | |
| 278 | - protected function assertInFuture(string $dateTime) |
|
| 279 | - { |
|
| 265 | + protected function assertInFuture(string $dateTime) { |
|
| 280 | 266 | $this->assertGreaterThan(new DateTime(), $this->parseUtc($dateTime)); |
| 281 | 267 | } |
| 282 | 268 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $this->expectExceptionMessage('empty list'); |
| 162 | 162 | |
| 163 | 163 | $oai = Endpoint::build($this->oaiUrl); |
| 164 | - $result = $oai->listRecords('mets', null, (new DateTime())->setDate(1900, 1, 1)); |
|
| 164 | + $result = $oai->listRecords('mets', NULL, (new DateTime())->setDate(1900, 1, 1)); |
|
| 165 | 165 | |
| 166 | 166 | $result->current(); |
| 167 | 167 | } |