‪TYPO3CMS  11.5
XmlSitemapXslTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
22 
24 {
25  protected ‪$coreExtensionsToLoad = ['seo'];
26 
31  'SYS' => [
32  'encryptionKey' => '4408d27a916d51e624b69af3554f516dbab61037a9f7b9fd6f81b4d3bedeccb6',
33  ],
34  'FE' => [
35  'cacheHash' => [
36  'requireCacheHashPresenceParameters' => ['value', 'testing[value]', 'tx_testing_link[value]'],
37  'excludedParameters' => ['tx_testing_link[excludedValue]'],
38  'enforceValidation' => false,
39  ],
40  'debug' => false,
41  ],
42  ];
43 
44  protected function setUp(): void
45  {
46  parent::setUp();
47  $this->‪importCSVDataSet(__DIR__ . '/../Fixtures/pages-sitemap.csv');
48  }
49 
54  public function ‪checkIfDefaultSitemapReturnsDefaultXsl(array $typoscriptSetupFiles, string $sitemap, string $xslFilePath): void
55  {
56  $this->setUpFrontendRootPage(
57  1,
58  [
59  'constants' => ['EXT:seo/Configuration/TypoScript/XmlSitemap/constants.typoscript'],
60  'setup' => $typoscriptSetupFiles,
61  ]
62  );
63 
65  'website-local',
66  $this->‪buildSiteConfiguration(1, 'http://localhost/'),
67  [
68  $this->‪buildDefaultLanguageConfiguration('EN', '/'),
69  ]
70  );
71 
72  $config = [
73  'id' => 1,
74  'type' => 1533906435,
75  ];
76 
77  if (!empty($sitemap)) {
78  $config['sitemap'] = $sitemap;
79  }
80 
81  $response = $this->executeFrontendSubRequest(
82  (new InternalRequest('http://localhost/'))->withQueryParameters($config)
83  );
84 
85  self::assertMatchesRegularExpression('/<\?xml-stylesheet type="text\/xsl" href="' . $xslFilePath . '"\?>/', (string)$response->getBody());
86  }
87 
88  public function ‪getXslFilePathsDataProvider(): array
89  {
90  return [
91  [
92  [
93  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
94  ],
95  '',
96  '\/typo3\/sysext\/seo\/Resources\/Public\/CSS\/Sitemap.xsl',
97  ],
98  [
99  [
100  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
101  'EXT:seo/Tests/Functional/Fixtures/sitemap-xsl1.typoscript',
102  ],
103  '',
104  '\/typo3\/sysext\/seo\/Tests\/Functional\/Fixtures\/XslFile1.xsl',
105  ],
106  [
107  [
108  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
109  'EXT:seo/Tests/Functional/Fixtures/sitemap-xsl2.typoscript',
110  ],
111  '',
112  '\/typo3\/sysext\/seo\/Tests\/Functional\/Fixtures\/XslFile2.xsl',
113  ],
114  [
115  [
116  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
117  'EXT:seo/Tests/Functional/Fixtures/records.typoscript',
118  'EXT:seo/Tests/Functional/Fixtures/sitemap-xsl3.typoscript',
119  ],
120  '',
121  '\/typo3\/sysext\/seo\/Tests\/Functional\/Fixtures\/XslFile1.xsl',
122  ],
123  [
124  [
125  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
126  'EXT:seo/Tests/Functional/Fixtures/records.typoscript',
127  'EXT:seo/Tests/Functional/Fixtures/sitemap-xsl3.typoscript',
128  ],
129  'records',
130  '\/typo3\/sysext\/seo\/Tests\/Functional\/Fixtures\/XslFile3.xsl',
131  ],
132  [
133  [
134  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
135  'EXT:seo/Tests/Functional/Fixtures/records.typoscript',
136  'EXT:seo/Tests/Functional/Fixtures/sitemap-xsl3.typoscript',
137  ],
138  'pages',
139  '\/typo3\/sysext\/seo\/Tests\/Functional\/Fixtures\/XslFile1.xsl',
140  ],
141  ];
142  }
143 }
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration
‪writeSiteConfiguration(string $identifier, array $site=[], array $languages=[], array $errorHandling=[])
Definition: SiteBasedTestTrait.php:58
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\AbstractTestCase
Definition: AbstractTestCase.php:29
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap
Definition: AbstractXmlSitemapPagesTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildDefaultLanguageConfiguration
‪array buildDefaultLanguageConfiguration(string $identifier, string $base)
Definition: SiteBasedTestTrait.php:126
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapXslTest\checkIfDefaultSitemapReturnsDefaultXsl
‪checkIfDefaultSitemapReturnsDefaultXsl(array $typoscriptSetupFiles, string $sitemap, string $xslFilePath)
Definition: XmlSitemapXslTest.php:53
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapXslTest\importCSVDataSet
‪array< string, $configurationToUseInTestInstance=array('SYS'=>['encryptionKey'=> '4408d27a916d51e624b69af3554f516dbab61037a9f7b9fd6f81b4d3bedeccb6',], 'FE'=>['cacheHash'=>['requireCacheHashPresenceParameters'=>[ 'value', 'testing[value]', 'tx_testing_link[value]'], 'excludedParameters'=>[ 'tx_testing_link[excludedValue]'], 'enforceValidation'=> false,], 'debug'=> false,],);protected setUp():void { parent::setUp();$this-> importCSVDataSet(__DIR__ . '/../Fixtures/pages-sitemap.csv')
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapXslTest\getXslFilePathsDataProvider
‪getXslFilePathsDataProvider()
Definition: XmlSitemapXslTest.php:87
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration
‪array buildSiteConfiguration(int $rootPageId, string $base='')
Definition: SiteBasedTestTrait.php:111
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\AbstractTestCase\$configurationToUseInTestInstance
‪$configurationToUseInTestInstance
Definition: AbstractTestCase.php:40
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapXslTest\$coreExtensionsToLoad
‪$coreExtensionsToLoad
Definition: XmlSitemapXslTest.php:25
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapXslTest
Definition: XmlSitemapXslTest.php:24