@@ -19,13 +19,11 @@ |
||
19 | 19 | /** |
20 | 20 | * Add inline JavaScript code to footer * |
21 | 21 | */ |
22 | -class JsFooterViewHelper extends AbstractViewHelper |
|
23 | -{ |
|
22 | +class JsFooterViewHelper extends AbstractViewHelper { |
|
24 | 23 | /** |
25 | 24 | * Initialize arguments. |
26 | 25 | */ |
27 | - public function initializeArguments() |
|
28 | - { |
|
26 | + public function initializeArguments() { |
|
29 | 27 | parent::initializeArguments(); |
30 | 28 | $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', true); |
31 | 29 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function initializeArguments() |
28 | 28 | { |
29 | 29 | parent::initializeArguments(); |
30 | - $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', true); |
|
30 | + $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', TRUE); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | $fulltext['mimetype'] = $this->document->getDoc()->getFileMimeType($this->document->getDoc()->physicalStructureInfo[$this->document->getDoc()->physicalStructure[$page]]['files'][$fileGrpFulltext]); |
147 | 147 | break; |
148 | 148 | } else { |
149 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrp "' . $fileGrpFulltext . '"'); |
|
149 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrp "'.$fileGrpFulltext.'"'); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | if (empty($fulltext)) { |
153 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrps "' . $this->settings['fileGrpFulltext'] . '"'); |
|
153 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrps "'.$this->settings['fileGrpFulltext'].'"'); |
|
154 | 154 | } |
155 | 155 | return $fulltext; |
156 | 156 | } |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | $viewerConfiguration = '$(document).ready(function() { |
169 | 169 | if (dlfUtils.exists(dlfViewer)) { |
170 | 170 | tx_dlf_viewer = new dlfViewer({ |
171 | - controls: ["' . implode('", "', $this->controls) . '"], |
|
172 | - div: "' . $this->settings['elementId'] . '", |
|
173 | - images: ' . json_encode($this->images) . ', |
|
174 | - fulltexts: ' . json_encode($this->fulltexts) . ', |
|
175 | - annotationContainers: ' . json_encode($this->annotationContainers) . ', |
|
176 | - useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0) . ' |
|
171 | + controls: ["' . implode('", "', $this->controls).'"], |
|
172 | + div: "' . $this->settings['elementId'].'", |
|
173 | + images: ' . json_encode($this->images).', |
|
174 | + fulltexts: ' . json_encode($this->fulltexts).', |
|
175 | + annotationContainers: ' . json_encode($this->annotationContainers).', |
|
176 | + useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0).' |
|
177 | 177 | }); |
178 | 178 | } |
179 | 179 | });'; |
@@ -271,11 +271,11 @@ discard block |
||
271 | 271 | $image['mimetype'] = $this->document->getDoc()->getFileMimeType($this->document->getDoc()->physicalStructureInfo[$this->document->getDoc()->physicalStructure[$page]]['files'][$fileGrpImages]); |
272 | 272 | break; |
273 | 273 | } else { |
274 | - $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"'); |
|
274 | + $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"'); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | if (empty($image)) { |
278 | - $this->logger->warning('No image file found for page "' . $page . '" in fileGrps "' . $this->settings['fileGrpImages'] . '"'); |
|
278 | + $this->logger->warning('No image file found for page "'.$page.'" in fileGrps "'.$this->settings['fileGrpImages'].'"'); |
|
279 | 279 | } |
280 | 280 | return $image; |
281 | 281 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @subpackage dlf |
27 | 27 | * @access public |
28 | 28 | */ |
29 | -class PageViewController extends AbstractController |
|
30 | -{ |
|
29 | +class PageViewController extends AbstractController { |
|
31 | 30 | /** |
32 | 31 | * Holds the controls to add to the map |
33 | 32 | * |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | * |
66 | 65 | * @return void |
67 | 66 | */ |
68 | - public function mainAction() |
|
69 | - { |
|
67 | + public function mainAction() { |
|
70 | 68 | // Load current document. |
71 | 69 | $this->loadDocument($this->requestData); |
72 | 70 | if ( |
@@ -121,8 +119,7 @@ discard block |
||
121 | 119 | * |
122 | 120 | * @return array URL and MIME type of fulltext file |
123 | 121 | */ |
124 | - protected function getFulltext($page) |
|
125 | - { |
|
122 | + protected function getFulltext($page) { |
|
126 | 123 | $fulltext = []; |
127 | 124 | // Get fulltext link. |
128 | 125 | $fileGrpsFulltext = GeneralUtility::trimExplode(',', $this->extConf['fileGrpFulltext']); |
@@ -162,8 +159,7 @@ discard block |
||
162 | 159 | * |
163 | 160 | * @return void |
164 | 161 | */ |
165 | - protected function addViewerJS() |
|
166 | - { |
|
162 | + protected function addViewerJS() { |
|
167 | 163 | // Viewer configuration. |
168 | 164 | $viewerConfiguration = '$(document).ready(function() { |
169 | 165 | if (dlfUtils.exists(dlfViewer)) { |
@@ -189,8 +185,7 @@ discard block |
||
189 | 185 | * @return array An array containing the IRIs of the AnnotationLists / AnnotationPages as well as |
190 | 186 | * some information about the canvas. |
191 | 187 | */ |
192 | - protected function getAnnotationContainers($page) |
|
193 | - { |
|
188 | + protected function getAnnotationContainers($page) { |
|
194 | 189 | if ($this->document->getDoc() instanceof IiifManifest) { |
195 | 190 | $canvasId = $this->document->getDoc()->physicalStructure[$page]; |
196 | 191 | $iiif = $this->document->getDoc()->getIiif(); |
@@ -246,8 +241,7 @@ discard block |
||
246 | 241 | * |
247 | 242 | * @return array URL and MIME type of image file |
248 | 243 | */ |
249 | - protected function getImage($page) |
|
250 | - { |
|
244 | + protected function getImage($page) { |
|
251 | 245 | $image = []; |
252 | 246 | // Get @USE value of METS fileGrp. |
253 | 247 | $fileGrpsImages = GeneralUtility::trimExplode(',', $this->extConf['fileGrpImages']); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | // Load current document. |
71 | 71 | $this->loadDocument($this->requestData); |
72 | 72 | if ( |
73 | - $this->document === null |
|
73 | + $this->document === NULL |
|
74 | 74 | || $this->document->getDoc()->numPages < 1 |
75 | 75 | ) { |
76 | 76 | // Quit without doing anything if required variables are not set. |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // Configure @action URL for form. |
134 | 134 | $uri = $this->uriBuilder->reset() |
135 | 135 | ->setTargetPageUid($GLOBALS['TSFE']->id) |
136 | - ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false) |
|
136 | + ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE) |
|
137 | 137 | ->setArguments([ |
138 | 138 | 'eID' => 'tx_dlf_pageview_proxy', |
139 | 139 | 'url' => $fulltext['url'], |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | if ($iiif instanceof ManifestInterface) { |
198 | 198 | $canvas = $iiif->getContainedResourceById($canvasId); |
199 | 199 | /* @var $canvas \Ubl\Iiif\Presentation\Common\Model\Resources\CanvasInterface */ |
200 | - if ($canvas != null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
200 | + if ($canvas != NULL && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
201 | 201 | $annotationContainers = []; |
202 | 202 | /* |
203 | 203 | * TODO Analyzing the annotations on the server side requires loading the annotation lists / pages |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | * On the other hand, server connections are potentially better than client connections. Downloading annotation lists |
208 | 208 | */ |
209 | 209 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
210 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
210 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
211 | 211 | foreach ($textAnnotations as $annotation) { |
212 | 212 | if ( |
213 | 213 | $annotation->getBody()->getFormat() == 'text/plain' |
214 | - && $annotation->getBody()->getChars() != null |
|
214 | + && $annotation->getBody()->getChars() != NULL |
|
215 | 215 | ) { |
216 | 216 | $annotationListData = []; |
217 | 217 | $annotationListData['uri'] = $annotationContainer->getId(); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | // Configure @action URL for form. |
260 | 260 | $uri = $this->uriBuilder->reset() |
261 | 261 | ->setTargetPageUid($GLOBALS['TSFE']->id) |
262 | - ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false) |
|
262 | + ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE) |
|
263 | 263 | ->setArguments([ |
264 | 264 | 'eID' => 'tx_dlf_pageview_proxy', |
265 | 265 | 'url' => $image['url'], |
@@ -5,10 +5,8 @@ |
||
5 | 5 | use Kitodo\Dlf\Common\Helper; |
6 | 6 | use TYPO3\TestingFramework\Core\Unit\UnitTestCase; |
7 | 7 | |
8 | -class HelperTest extends UnitTestCase |
|
9 | -{ |
|
10 | - public function assertInvalidXml($xml) |
|
11 | - { |
|
8 | +class HelperTest extends UnitTestCase { |
|
9 | + public function assertInvalidXml($xml) { |
|
12 | 10 | $result = Helper::getXmlFileAsString($xml); |
13 | 11 | $this->assertEquals(false, $result); |
14 | 12 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | public function assertInvalidXml($xml) |
11 | 11 | { |
12 | 12 | $result = Helper::getXmlFileAsString($xml); |
13 | - $this->assertEquals(false, $result); |
|
13 | + $this->assertEquals(FALSE, $result); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | /** |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function invalidXmlYieldsFalse(): void |
21 | 21 | { |
22 | - $this->assertInvalidXml(false); |
|
23 | - $this->assertInvalidXml(null); |
|
22 | + $this->assertInvalidXml(FALSE); |
|
23 | + $this->assertInvalidXml(NULL); |
|
24 | 24 | $this->assertInvalidXml(1); |
25 | 25 | $this->assertInvalidXml([]); |
26 | 26 | $this->assertInvalidXml(new \stdClass()); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | <root> |
41 | 41 | <single /> |
42 | 42 | </root> |
43 | -XML; |
|
43 | +xml; |
|
44 | 44 | $node = Helper::getXmlFileAsString($xml); |
45 | 45 | $this->assertIsObject($node); |
46 | 46 | $this->assertEquals('root', $node->getName()); |
@@ -15,10 +15,10 @@ |
||
15 | 15 | preg_match("@.*/(?:acceptance|functional-[a-z0-9]+)@", $_SERVER['REQUEST_URI'], $matches); |
16 | 16 | |
17 | 17 | if (!empty($matches)) { |
18 | - $root = realpath($_SERVER['DOCUMENT_ROOT'] . $matches[0]); |
|
18 | + $root = realpath($_SERVER['DOCUMENT_ROOT'].$matches[0]); |
|
19 | 19 | if ($root !== false) { |
20 | - putenv('TYPO3_PATH_ROOT=' . $root); |
|
21 | - putenv('TYPO3_PATH_APP=' . $root); |
|
20 | + putenv('TYPO3_PATH_ROOT='.$root); |
|
21 | + putenv('TYPO3_PATH_APP='.$root); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 |
@@ -16,10 +16,10 @@ |
||
16 | 16 | |
17 | 17 | if (!empty($matches)) { |
18 | 18 | $root = realpath($_SERVER['DOCUMENT_ROOT'] . $matches[0]); |
19 | - if ($root !== false) { |
|
19 | + if ($root !== FALSE) { |
|
20 | 20 | putenv('TYPO3_PATH_ROOT=' . $root); |
21 | 21 | putenv('TYPO3_PATH_APP=' . $root); |
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
25 | -return false; |
|
25 | +return FALSE; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
71 | 71 | |
72 | 72 | if ($this->disableJsonWrappedResponse) { |
73 | - $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function ($ext) { |
|
73 | + $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function($ext) { |
|
74 | 74 | return $ext !== 'Resources/Core/Functional/Extensions/json_response'; |
75 | 75 | }); |
76 | 76 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
84 | 84 | |
85 | - $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/'; |
|
85 | + $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-'.$this->identifier.'/'; |
|
86 | 86 | $this->httpClient = new HttpClient([ |
87 | 87 | 'base_uri' => $this->baseUrl, |
88 | 88 | 'http_errors' => false, |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function addSiteConfig($identifier, $baseUrl) |
128 | 128 | { |
129 | - $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
|
129 | + $siteConfig = Yaml::parseFile(__DIR__.'/../Fixtures/siteconfig.yaml'); |
|
130 | 130 | $siteConfig['base'] = $baseUrl; |
131 | 131 | $siteConfig['languages'][0]['base'] = $baseUrl; |
132 | 132 | |
133 | - $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier; |
|
133 | + $siteConfigPath = $this->instancePath.'/typo3conf/sites/'.$identifier; |
|
134 | 134 | @mkdir($siteConfigPath, 0775, true); |
135 | - file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
|
135 | + file_put_contents($siteConfigPath.'/config.yaml', Yaml::dump($siteConfig)); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | protected function initializeRepository(string $className, int $storagePid) |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | * Base class for functional test cases. This provides some common configuration |
13 | 13 | * and collects utility methods for functional tests. |
14 | 14 | */ |
15 | -class FunctionalTestCase extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase |
|
16 | -{ |
|
15 | +class FunctionalTestCase extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase { |
|
17 | 16 | protected $testExtensionsToLoad = [ |
18 | 17 | 'typo3conf/ext/dlf', |
19 | 18 | ]; |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | */ |
64 | 63 | protected $httpClient; |
65 | 64 | |
66 | - public function __construct() |
|
67 | - { |
|
65 | + public function __construct() { |
|
68 | 66 | parent::__construct(); |
69 | 67 | |
70 | 68 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
@@ -91,8 +89,7 @@ discard block |
||
91 | 89 | $this->addSiteConfig('dlf-testing', $this->baseUrl); |
92 | 90 | } |
93 | 91 | |
94 | - protected function getDlfConfiguration() |
|
95 | - { |
|
92 | + protected function getDlfConfiguration() { |
|
96 | 93 | return [ |
97 | 94 | 'solrFieldAutocomplete' => 'autocomplete', |
98 | 95 | 'solrFieldCollection' => 'collection', |
@@ -124,8 +121,7 @@ discard block |
||
124 | 121 | ]; |
125 | 122 | } |
126 | 123 | |
127 | - protected function addSiteConfig($identifier, $baseUrl) |
|
128 | - { |
|
124 | + protected function addSiteConfig($identifier, $baseUrl) { |
|
129 | 125 | $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
130 | 126 | $siteConfig['base'] = $baseUrl; |
131 | 127 | $siteConfig['languages'][0]['base'] = $baseUrl; |
@@ -135,8 +131,7 @@ discard block |
||
135 | 131 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
136 | 132 | } |
137 | 133 | |
138 | - protected function initializeRepository(string $className, int $storagePid) |
|
139 | - { |
|
134 | + protected function initializeRepository(string $className, int $storagePid) { |
|
140 | 135 | $repository = $this->objectManager->get($className); |
141 | 136 | |
142 | 137 | $querySettings = $this->objectManager->get(Typo3QuerySettings::class); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @var bool |
50 | 50 | */ |
51 | - protected $disableJsonWrappedResponse = false; |
|
51 | + protected $disableJsonWrappedResponse = FALSE; |
|
52 | 52 | |
53 | 53 | /** @var ObjectManager */ |
54 | 54 | protected $objectManager; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/'; |
86 | 86 | $this->httpClient = new HttpClient([ |
87 | 87 | 'base_uri' => $this->baseUrl, |
88 | - 'http_errors' => false, |
|
88 | + 'http_errors' => FALSE, |
|
89 | 89 | ]); |
90 | 90 | |
91 | 91 | $this->addSiteConfig('dlf-testing', $this->baseUrl); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $siteConfig['languages'][0]['base'] = $baseUrl; |
132 | 132 | |
133 | 133 | $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier; |
134 | - @mkdir($siteConfigPath, 0775, true); |
|
134 | + @mkdir($siteConfigPath, 0775, TRUE); |
|
135 | 135 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
136 | 136 | } |
137 | 137 |
@@ -77,7 +77,7 @@ |
||
77 | 77 | ]); |
78 | 78 | |
79 | 79 | $this->assertEquals(200, $response->getStatusCode()); |
80 | - $this->assertEquals('This is some plain text test file.' . "\n", (string) $response->getBody()); |
|
80 | + $this->assertEquals('This is some plain text test file.'."\n", (string) $response->getBody()); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -6,19 +6,16 @@ |
||
6 | 6 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
7 | 7 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
8 | 8 | |
9 | -class PageViewProxyTest extends FunctionalTestCase |
|
10 | -{ |
|
9 | +class PageViewProxyTest extends FunctionalTestCase { |
|
11 | 10 | protected $disableJsonWrappedResponse = true; |
12 | 11 | |
13 | - protected function getDlfConfiguration() |
|
14 | - { |
|
12 | + protected function getDlfConfiguration() { |
|
15 | 13 | return array_merge(parent::getDlfConfiguration(), [ |
16 | 14 | 'enableInternalProxy' => true, |
17 | 15 | ]); |
18 | 16 | } |
19 | 17 | |
20 | - protected function queryProxy(array $query, string $method = 'GET') |
|
21 | - { |
|
18 | + protected function queryProxy(array $query, string $method = 'GET') { |
|
22 | 19 | $query['eID'] = 'tx_dlf_pageview_proxy'; |
23 | 20 | |
24 | 21 | return $this->httpClient->request($method, '', [ |
@@ -8,12 +8,12 @@ |
||
8 | 8 | |
9 | 9 | class PageViewProxyTest extends FunctionalTestCase |
10 | 10 | { |
11 | - protected $disableJsonWrappedResponse = true; |
|
11 | + protected $disableJsonWrappedResponse = TRUE; |
|
12 | 12 | |
13 | 13 | protected function getDlfConfiguration() |
14 | 14 | { |
15 | 15 | return array_merge(parent::getDlfConfiguration(), [ |
16 | - 'enableInternalProxy' => true, |
|
16 | + 'enableInternalProxy' => TRUE, |
|
17 | 17 | ]); |
18 | 18 | } |
19 | 19 |
@@ -5,12 +5,10 @@ |
||
5 | 5 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
6 | 6 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
7 | 7 | |
8 | -class PageViewProxyDisabledTest extends FunctionalTestCase |
|
9 | -{ |
|
8 | +class PageViewProxyDisabledTest extends FunctionalTestCase { |
|
10 | 9 | protected $disableJsonWrappedResponse = true; |
11 | 10 | |
12 | - protected function queryProxy(array $query, string $method = 'GET') |
|
13 | - { |
|
11 | + protected function queryProxy(array $query, string $method = 'GET') { |
|
14 | 12 | $query['eID'] = 'tx_dlf_pageview_proxy'; |
15 | 13 | |
16 | 14 | return $this->httpClient->request($method, '', [ |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | class PageViewProxyDisabledTest extends FunctionalTestCase |
9 | 9 | { |
10 | - protected $disableJsonWrappedResponse = true; |
|
10 | + protected $disableJsonWrappedResponse = TRUE; |
|
11 | 11 | |
12 | 12 | protected function queryProxy(array $query, string $method = 'GET') |
13 | 13 | { |
@@ -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); |
@@ -76,7 +76,7 @@ discard block |
||
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); |
@@ -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 | |
@@ -71,8 +69,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -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 | |
@@ -73,7 +73,7 @@ discard block |
||
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 |
||
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 | } |
@@ -21,9 +21,9 @@ |
||
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 | /** |
@@ -8,8 +8,7 @@ |
||
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 | */ |