Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php |
||
| 38 | class TypoScriptConfigurationTest extends UnitTest |
||
| 39 | { |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @var TypoScriptConfiguration |
||
| 43 | */ |
||
| 44 | protected $configuration; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return void |
||
| 48 | */ |
||
| 49 | public function setUp() |
||
| 50 | { |
||
| 51 | $fakeConfigurationArray = array(); |
||
| 52 | $fakeConfigurationArray['plugin.']['tx_solr.']['index.']['queue.']['tt_news.']['fields.']['content'] = 'SOLR_CONTENT'; |
||
| 53 | $fakeConfigurationArray['plugin.']['tx_solr.']['index.']['queue.']['tt_news.']['fields.']['content.']['field'] = 'bodytext'; |
||
| 54 | $this->configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @test |
||
| 59 | */ |
||
| 60 | public function canGetValueByPath() |
||
| 61 | { |
||
| 62 | $testPath = 'plugin.tx_solr.index.queue.tt_news.fields.content'; |
||
| 63 | $this->assertSame('SOLR_CONTENT', $this->configuration->getValueByPath($testPath), 'Could not get configuration value by path'); |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @test |
||
| 68 | */ |
||
| 69 | public function canGetObjectByPath() |
||
| 70 | { |
||
| 71 | $testPath = 'plugin.tx_solr.index.queue.tt_news.fields.content'; |
||
| 72 | $expectedResult = array( |
||
| 73 | 'content' => 'SOLR_CONTENT', |
||
| 74 | 'content.' => array('field' => 'bodytext') |
||
| 75 | ); |
||
| 76 | |||
| 77 | $this->assertSame($expectedResult, $this->configuration->getObjectByPath($testPath), 'Could not get configuration object by path'); |
||
| 78 | } |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @test |
||
| 82 | */ |
||
| 83 | public function canGetFacetLinkOptionsByFacetName() |
||
| 84 | { |
||
| 85 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 86 | 'search.' => array( |
||
| 87 | 'faceting.' => array( |
||
| 88 | 'facetLinkATagParams' => 'class="all-facets"', |
||
| 89 | 'facets.' => array( |
||
| 90 | 'color.' => array(), |
||
| 91 | 'type.' => array( |
||
| 92 | 'facetLinkATagParams' => 'class="type-facets"' |
||
| 93 | ) |
||
| 94 | ) |
||
| 95 | ) |
||
| 96 | ) |
||
| 97 | ); |
||
| 98 | |||
| 99 | |||
| 100 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 101 | $typeATagParams = $configuration->getSearchFacetingFacetLinkATagParamsByName('type'); |
||
| 102 | $this->assertSame('class="type-facets"', $typeATagParams, 'can not get concrete a tag param for type'); |
||
| 103 | |||
| 104 | $typeATagParams = $configuration->getSearchFacetingFacetLinkATagParamsByName('color'); |
||
| 105 | $this->assertSame('class="all-facets"', $typeATagParams, 'can not get concrete a tag param for color'); |
||
| 106 | } |
||
| 107 | |||
| 108 | |||
| 109 | /** |
||
| 110 | * @test |
||
| 111 | */ |
||
| 112 | public function canShowEvenIfEmptyFallBackToGlobalSetting() |
||
| 113 | { |
||
| 114 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 115 | 'search.' => array( |
||
| 116 | 'faceting.' => array( |
||
| 117 | 'showEmptyFacets' => true, |
||
| 118 | 'facets.' => array( |
||
| 119 | 'color.' => array(), |
||
| 120 | 'type.' => array( |
||
| 121 | 'showEvenWhenEmpty' => true |
||
| 122 | ) |
||
| 123 | ) |
||
| 124 | ) |
||
| 125 | ) |
||
| 126 | ); |
||
| 127 | |||
| 128 | |||
| 129 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 130 | $showEmptyType = $configuration->getSearchFacetingShowEmptyFacetsByName('type'); |
||
| 131 | $this->assertTrue($showEmptyType); |
||
| 132 | |||
| 133 | $showEmptyColor = $configuration->getSearchFacetingShowEmptyFacetsByName('color'); |
||
| 134 | $this->assertTrue($showEmptyColor); |
||
| 135 | |||
| 136 | |||
| 137 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 138 | 'search.' => array( |
||
| 139 | 'faceting.' => array( |
||
| 140 | 'facets.' => array( |
||
| 141 | 'color.' => array(), |
||
| 142 | 'type.' => array( |
||
| 143 | 'showEvenWhenEmpty' => true |
||
| 144 | ) |
||
| 145 | ) |
||
| 146 | ) |
||
| 147 | ) |
||
| 148 | ); |
||
| 149 | |||
| 150 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 151 | |||
| 152 | $showEmptyType = $configuration->getSearchFacetingShowEmptyFacetsByName('type'); |
||
| 153 | $this->assertTrue($showEmptyType); |
||
| 154 | |||
| 155 | $showEmptyColor = $configuration->getSearchFacetingShowEmptyFacetsByName('color'); |
||
| 156 | $this->assertFalse($showEmptyColor); |
||
| 157 | } |
||
| 158 | |||
| 159 | /** |
||
| 160 | * @test |
||
| 161 | */ |
||
| 162 | public function canGetJavaScriptFileByName() |
||
| 163 | { |
||
| 164 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 165 | 'javascriptFiles.' => array( |
||
| 166 | 'ui' => 'ui.js' |
||
| 167 | ) |
||
| 168 | ); |
||
| 169 | |||
| 170 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 171 | $this->assertSame('ui.js', $configuration->getJavaScriptFileByFileKey('ui'), 'Could get configured javascript file'); |
||
| 172 | } |
||
| 173 | |||
| 174 | /** |
||
| 175 | * @test |
||
| 176 | */ |
||
| 177 | public function canGetIndexQueueTableOrFallbackToConfigurationName() |
||
| 178 | { |
||
| 179 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 180 | 'index.' => array( |
||
| 181 | 'queue.' => array( |
||
| 182 | 'pages.' => array( |
||
| 183 | ), |
||
| 184 | 'custom.' => array( |
||
| 185 | 'table' => 'tx_model_custom' |
||
| 186 | ) |
||
| 187 | ) |
||
| 188 | ) |
||
| 189 | ); |
||
| 190 | |||
| 191 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 192 | |||
| 193 | $customTableExpected = $configuration->getIndexQueueTableNameOrFallbackToConfigurationName('pages'); |
||
| 194 | $this->assertSame($customTableExpected, 'pages', 'Can not fallback to configurationName'); |
||
| 195 | |||
| 196 | $customTableExpected = $configuration->getIndexQueueTableNameOrFallbackToConfigurationName('custom'); |
||
| 197 | $this->assertSame($customTableExpected, 'tx_model_custom', 'Usage of custom table tx_model_custom was expected'); |
||
| 198 | } |
||
| 199 | |||
| 200 | |||
| 201 | /** |
||
| 202 | * @test |
||
| 203 | */ |
||
| 204 | public function canGetIndexQueueConfigurationNames() |
||
| 205 | { |
||
| 206 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 207 | 'index.' => array( |
||
| 208 | 'queue.' => array( |
||
| 209 | 'pages' => 1, |
||
| 210 | 'pages.' => array( |
||
| 211 | ), |
||
| 212 | 'custom.' => array( |
||
| 213 | 'table' => 'tx_model_custom' |
||
| 214 | ) |
||
| 215 | ) |
||
| 216 | ) |
||
| 217 | ); |
||
| 218 | |||
| 219 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 220 | $enabledIndexQueueNames = $configuration->getEnabledIndexQueueConfigurationNames(); |
||
| 221 | |||
| 222 | $this->assertCount(1, $enabledIndexQueueNames, 'Retrieved unexpected amount of index queue configurations'); |
||
| 223 | $this->assertContains('pages', $enabledIndexQueueNames, 'Pages was no enabled index queue configuration'); |
||
| 224 | |||
| 225 | |||
| 226 | $fakeConfigurationArray['plugin.']['tx_solr.']['index.']['queue.']['custom'] = 1; |
||
| 227 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 228 | $enabledIndexQueueNames = $configuration->getEnabledIndexQueueConfigurationNames(); |
||
| 229 | |||
| 230 | $this->assertCount(2, $enabledIndexQueueNames, 'Retrieved unexpected amount of index queue configurations'); |
||
| 231 | $this->assertContains('custom', $enabledIndexQueueNames, 'Pages was no enabled index queue configuration'); |
||
| 232 | } |
||
| 233 | |||
| 234 | |||
| 235 | /** |
||
| 236 | * @test |
||
| 237 | */ |
||
| 238 | public function canGetAdditionalWhereClause() |
||
| 239 | { |
||
| 240 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 241 | 'index.' => array( |
||
| 242 | 'queue.' => array( |
||
| 243 | 'pages' => 1, |
||
| 244 | 'pages.' => array( |
||
| 245 | ), |
||
| 246 | 'custom.' => array( |
||
| 247 | 'additionalWhereClause' => '1=1' |
||
| 248 | ) |
||
| 249 | ) |
||
| 250 | ) |
||
| 251 | ); |
||
| 252 | |||
| 253 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 254 | |||
| 255 | $this->assertEquals('', $configuration->getIndexQueueAdditionalWhereClauseByConfigurationName('pages')); |
||
| 256 | $this->assertEquals(' AND 1=1', $configuration->getIndexQueueAdditionalWhereClauseByConfigurationName('custom')); |
||
| 257 | $this->assertEquals('', $configuration->getIndexQueueAdditionalWhereClauseByConfigurationName('notconfigured')); |
||
| 258 | } |
||
| 259 | |||
| 260 | /** |
||
| 261 | * @test |
||
| 262 | */ |
||
| 263 | public function canGetIndexQueueConfigurationNamesByTableName() |
||
| 264 | { |
||
| 265 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 266 | 'index.' => array( |
||
| 267 | 'queue.' => array( |
||
| 268 | 'tx_model_news' => 1, |
||
| 269 | 'tx_model_news.' => array( |
||
| 270 | ), |
||
| 271 | 'custom_one' => 1, |
||
| 272 | 'custom_one.' => array( |
||
| 273 | 'table' => 'tx_model_bar' |
||
| 274 | ), |
||
| 275 | |||
| 276 | 'custom_two' => 1, |
||
| 277 | 'custom_two.' => array( |
||
| 278 | 'table' => 'tx_model_news' |
||
| 279 | ) |
||
| 280 | ) |
||
| 281 | ) |
||
| 282 | ); |
||
| 283 | |||
| 284 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 285 | $this->assertEquals(array('tx_model_news', 'custom_two'), $configuration->getIndexQueueConfigurationNamesByTableName('tx_model_news')); |
||
| 286 | } |
||
| 287 | |||
| 288 | /** |
||
| 289 | * @test |
||
| 290 | */ |
||
| 291 | public function canGetLoggingEnableStateForIndexQueueByConfigurationName() |
||
| 292 | { |
||
| 293 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 294 | 'logging.' => array( |
||
| 295 | 'indexing.' => array( |
||
| 296 | 'queue.' => array( |
||
| 297 | 'pages' => 1 |
||
| 298 | ) |
||
| 299 | ) |
||
| 300 | ) |
||
| 301 | ); |
||
| 302 | |||
| 303 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 304 | $this->assertTrue($configuration->getLoggingIndexingQueueOperationsByConfigurationNameWithFallBack('pages'), |
||
| 305 | 'Wrong logging state for pages index queue'); |
||
| 306 | $this->assertFalse($configuration->getLoggingIndexingQueueOperationsByConfigurationNameWithFallBack('tt_content'), |
||
| 307 | 'Wrong logging state for tt_content index queue'); |
||
| 308 | } |
||
| 309 | |||
| 310 | |||
| 311 | /** |
||
| 312 | * @test |
||
| 313 | */ |
||
| 314 | public function canGetLoggingEnableStateForIndexQueueByConfigurationNameByFallingBack() |
||
| 315 | { |
||
| 316 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 317 | 'logging.' => array( |
||
| 318 | 'indexing' => 1, |
||
| 319 | 'indexing.' => array( |
||
| 320 | 'queue.' => array( |
||
| 321 | 'pages' => 0 |
||
| 322 | ) |
||
| 323 | ) |
||
| 324 | ) |
||
| 325 | ); |
||
| 326 | |||
| 327 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 328 | $this->assertTrue($configuration->getLoggingIndexingQueueOperationsByConfigurationNameWithFallBack('pages'), |
||
| 329 | 'Wrong logging state for pages index queue'); |
||
| 330 | $this->assertTrue($configuration->getLoggingIndexingQueueOperationsByConfigurationNameWithFallBack('tt_content'), |
||
| 331 | 'Wrong logging state for tt_content index queue'); |
||
| 332 | } |
||
| 333 | |||
| 334 | /** |
||
| 335 | * @test |
||
| 336 | */ |
||
| 337 | public function canGetIndexFieldsConfigurationByConfigurationName() |
||
| 338 | { |
||
| 339 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 340 | 'index.' => array( |
||
| 341 | 'queue.' => array( |
||
| 342 | 'pages.' => array( |
||
| 343 | 'fields.' => array( |
||
| 344 | 'sortSubTitle_stringS' => 'subtitle' |
||
| 345 | ) |
||
| 346 | ) |
||
| 347 | ) |
||
| 348 | ) |
||
| 349 | ); |
||
| 350 | |||
| 351 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 352 | |||
| 353 | $retrievedConfiguration = $configuration->getIndexQueueFieldsConfigurationByConfigurationName('pages'); |
||
| 354 | $this->assertEquals(array('sortSubTitle_stringS' => 'subtitle'), $retrievedConfiguration); |
||
| 355 | } |
||
| 356 | |||
| 357 | /** |
||
| 358 | * @test |
||
| 359 | */ |
||
| 360 | public function canGetIndexQueueMappedFieldNamesByConfigurationName() |
||
| 361 | { |
||
| 362 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 363 | 'index.' => array( |
||
| 364 | 'queue.' => array( |
||
| 365 | 'pages.' => array( |
||
| 366 | 'fields.' => array( |
||
| 367 | 'sortSubTitle_stringS' => 'subtitle', |
||
| 368 | 'subTitle_stringM' => 'subtitle', |
||
| 369 | 'fooShouldBeSkipped.' => array() |
||
| 370 | ) |
||
| 371 | ) |
||
| 372 | ) |
||
| 373 | ) |
||
| 374 | ); |
||
| 375 | |||
| 376 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 377 | |||
| 378 | $mappedFieldNames = $configuration->getIndexQueueMappedFieldsByConfigurationName('pages'); |
||
| 379 | $this->assertEquals(array('sortSubTitle_stringS', 'subTitle_stringM'), $mappedFieldNames); |
||
| 380 | } |
||
| 381 | |||
| 382 | /** |
||
| 383 | * @test |
||
| 384 | */ |
||
| 385 | public function canGetIndexAdditionalFieldsConfiguration() |
||
| 386 | { |
||
| 387 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 388 | 'index.' => array( |
||
| 389 | 'additionalFields.' => array( |
||
| 390 | 'additional_sortSubTitle_stringS' => 'subtitle' |
||
| 391 | ) |
||
| 392 | ) |
||
| 393 | ); |
||
| 394 | |||
| 395 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 396 | |||
| 397 | $retrievedConfiguration = $configuration->getIndexAdditionalFieldsConfiguration(); |
||
| 398 | $this->assertEquals(array('additional_sortSubTitle_stringS' => 'subtitle'), $retrievedConfiguration); |
||
| 399 | } |
||
| 400 | |||
| 401 | |||
| 402 | |||
| 403 | /** |
||
| 404 | * @test |
||
| 405 | */ |
||
| 406 | public function canGetIndexMappedAdditionalFieldNames() |
||
| 407 | { |
||
| 408 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 409 | 'index.' => array( |
||
| 410 | 'additionalFields.' => array( |
||
| 411 | 'additional_sortSubTitle_stringS' => 'subtitle' |
||
| 412 | ) |
||
| 413 | ) |
||
| 414 | ); |
||
| 415 | |||
| 416 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 417 | |||
| 418 | $retrievedConfiguration = $configuration->getIndexMappedAdditionalFieldNames(); |
||
| 419 | $this->assertEquals(array('additional_sortSubTitle_stringS'), $retrievedConfiguration); |
||
| 420 | } |
||
| 421 | |||
| 422 | /** |
||
| 423 | * @test |
||
| 424 | */ |
||
| 425 | public function canGetIndexQueueIndexerByConfigurationName() |
||
| 426 | { |
||
| 427 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 428 | 'index.' => array( |
||
| 429 | 'queue.' => array( |
||
| 430 | 'pages.' => array( |
||
| 431 | 'indexer' => 'Foobar' |
||
| 432 | ) |
||
| 433 | ) |
||
| 434 | ) |
||
| 435 | ); |
||
| 436 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 437 | $configuredIndexer = $configuration->getIndexQueueIndexerByConfigurationName('pages'); |
||
| 438 | $this->assertSame('Foobar', $configuredIndexer, 'Retrieved unexpected indexer from typoscript configuration'); |
||
| 439 | } |
||
| 440 | |||
| 441 | /** |
||
| 442 | * @test |
||
| 443 | */ |
||
| 444 | public function canGetIndexQueueIndexerConfigurationByConfigurationName() |
||
| 445 | { |
||
| 446 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 447 | 'index.' => array( |
||
| 448 | 'queue.' => array( |
||
| 449 | 'pages.' => array( |
||
| 450 | 'indexer' => 'Foobar', |
||
| 451 | 'indexer.' => array('configuration' => 'test') |
||
| 452 | ) |
||
| 453 | ) |
||
| 454 | ) |
||
| 455 | ); |
||
| 456 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 457 | $configuredIndexer = $configuration->getIndexQueueIndexerConfigurationByConfigurationName('pages'); |
||
| 458 | $this->assertSame(array('configuration' => 'test'), $configuredIndexer, 'Retrieved unexpected indexer configuration from typoscript configuration'); |
||
| 459 | } |
||
| 460 | |||
| 461 | /** |
||
| 462 | * @test |
||
| 463 | */ |
||
| 464 | public function canGetIndexQueuePagesAllowedPageTypesArray() |
||
| 465 | { |
||
| 466 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 467 | 'index.' => array( |
||
| 468 | 'queue.' => array( |
||
| 469 | 'pages.' => array( |
||
| 470 | 'allowedPageTypes' => '1,2, 7' |
||
| 471 | ) |
||
| 472 | ) |
||
| 473 | ) |
||
| 474 | ); |
||
| 475 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 476 | $allowedPageTypes = $configuration->getIndexQueuePagesAllowedPageTypesArray(); |
||
| 477 | $this->assertEquals(array(1, 2, 7), $allowedPageTypes, 'Can not get allowed pagestype from configuration'); |
||
| 478 | } |
||
| 479 | |||
| 480 | |||
| 481 | /** |
||
| 482 | * @test |
||
| 483 | */ |
||
| 484 | public function canGetIndexQueuePagesExcludeContentByClassArray() |
||
| 485 | { |
||
| 486 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 487 | 'index.' => array( |
||
| 488 | 'queue.' => array( |
||
| 489 | 'pages.' => array( |
||
| 490 | 'excludeContentByClass' => 'excludeClass' |
||
| 491 | ) |
||
| 492 | ) |
||
| 493 | ) |
||
| 494 | ); |
||
| 495 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 496 | $excludeClasses = $configuration->getIndexQueuePagesExcludeContentByClassArray(); |
||
| 497 | $this->assertEquals(array('excludeClass'), $excludeClasses, 'Can not get exclude patterns from configuration'); |
||
| 498 | } |
||
| 499 | |||
| 500 | /** |
||
| 501 | * @test |
||
| 502 | */ |
||
| 503 | public function canSetSearchQueryFilterConfiguration() |
||
| 504 | { |
||
| 505 | $configuration = new TypoScriptConfiguration([]); |
||
| 506 | $this->assertEquals([], $configuration->getSearchQueryFilterConfiguration()); |
||
| 507 | $configuration->setSearchQueryFilterConfiguration(['foo']); |
||
| 508 | $this->assertEquals(['foo'], $configuration->getSearchQueryFilterConfiguration()); |
||
| 509 | } |
||
| 510 | |||
| 511 | /** |
||
| 512 | * @test |
||
| 513 | */ |
||
| 514 | public function canRemovePageSectionFilter() |
||
| 515 | { |
||
| 516 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 517 | 'search.' => array( |
||
| 518 | 'query.' => array( |
||
| 519 | 'filter.' => array( |
||
| 520 | '__pageSections' => '1,2,3' |
||
| 521 | ) |
||
| 522 | ) |
||
| 523 | ) |
||
| 524 | ); |
||
| 525 | |||
| 526 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 527 | $this->assertEquals(['__pageSections' => '1,2,3'], $configuration->getSearchQueryFilterConfiguration()); |
||
| 528 | |||
| 529 | $configuration->removeSearchQueryFilterForPageSections(); |
||
| 530 | $this->assertEquals([], $configuration->getSearchQueryFilterConfiguration()); |
||
| 531 | } |
||
| 532 | |||
| 533 | /** |
||
| 534 | * @test |
||
| 535 | */ |
||
| 536 | public function removePageSectionFilterIsKeepingOtherFilters() |
||
| 537 | { |
||
| 538 | $fakeConfigurationArray['plugin.']['tx_solr.'] = array( |
||
| 539 | 'search.' => array( |
||
| 540 | 'query.' => array( |
||
| 541 | 'filter.' => array( |
||
| 542 | 'type:pages', '__pageSections' => '1,2,3' |
||
| 543 | ) |
||
| 544 | ) |
||
| 545 | ) |
||
| 546 | ); |
||
| 547 | |||
| 548 | $configuration = new TypoScriptConfiguration($fakeConfigurationArray); |
||
| 549 | $this->assertEquals(['type:pages', '__pageSections' => '1,2,3'], $configuration->getSearchQueryFilterConfiguration()); |
||
| 550 | |||
| 551 | $configuration->removeSearchQueryFilterForPageSections(); |
||
| 552 | $this->assertEquals(['type:pages'], $configuration->getSearchQueryFilterConfiguration()); |
||
| 553 | } |
||
| 554 | } |
||
| 555 |