‪TYPO3CMS  10.4
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 {
28  protected ‪$coreExtensionsToLoad = [
29  'core', 'frontend', 'seo'
30  ];
31 
33  'SYS' => [
34  'encryptionKey' => '4408d27a916d51e624b69af3554f516dbab61037a9f7b9fd6f81b4d3bedeccb6',
35  ],
36  'FE' => [
37  'cacheHash' => [
38  'requireCacheHashPresenceParameters' => ['value', 'testing[value]', 'tx_testing_link[value]'],
39  'excludedParameters' => ['tx_testing_link[excludedValue]'],
40  'enforceValidation' => false,
41  ],
42  'debug' => false,
43  ],
44  ];
45 
46  protected function ‪setUp(): void
47  {
48  parent::setUp();
49  $this->importDataSet('EXT:seo/Tests/Functional/Fixtures/pages-sitemap.xml');
50  }
51 
56  public function ‪checkIfDefaultSitemapReturnsDefaultXsl(array $typoscriptSetupFiles, string $sitemap, string $xslFilePath): void
57  {
58  $this->setUpFrontendRootPage(
59  1,
60  [
61  'constants' => ['EXT:seo/Configuration/TypoScript/XmlSitemap/constants.typoscript'],
62  'setup' => $typoscriptSetupFiles
63  ]
64  );
65 
67  'website-local',
68  $this->‪buildSiteConfiguration(1, 'http://localhost/'),
69  [
70  $this->‪buildDefaultLanguageConfiguration('EN', '/')
71  ]
72  );
73 
74  $config = [
75  'id' => 1,
76  'type' => 1533906435
77  ];
78 
79  if (!empty($sitemap)) {
80  $config['sitemap'] = $sitemap;
81  }
82 
83  $response = $this->executeFrontendRequest(
84  (new InternalRequest('http://localhost/'))->withQueryParameters($config)
85  );
86 
87  self::assertRegExp('/<\?xml-stylesheet type="text\/xsl" href="' . $xslFilePath . '"\?>/', (string)$response->getBody());
88  }
89 
90  public function ‪getXslFilePaths()
91  {
92  return [
93  [
94  [
95  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript'
96  ],
97  '',
98  '\/typo3\/sysext\/seo\/Resources\/Public\/CSS\/Sitemap.xsl'
99  ],
100  [
101  [
102  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
103  'EXT:seo/Tests/Functional/Fixtures/sitemap-xsl1.typoscript'
104  ],
105  '',
106  '\/typo3\/sysext\/seo\/Tests\/Functional\/Fixtures\/XslFile1.xsl'
107  ],
108  [
109  [
110  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
111  'EXT:seo/Tests/Functional/Fixtures/sitemap-xsl2.typoscript'
112  ],
113  '',
114  '\/typo3\/sysext\/seo\/Tests\/Functional\/Fixtures\/XslFile2.xsl'
115  ],
116  [
117  [
118  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
119  'EXT:seo/Tests/Functional/Fixtures/records.typoscript',
120  'EXT:seo/Tests/Functional/Fixtures/sitemap-xsl3.typoscript'
121  ],
122  '',
123  '\/typo3\/sysext\/seo\/Tests\/Functional\/Fixtures\/XslFile1.xsl'
124  ],
125  [
126  [
127  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
128  'EXT:seo/Tests/Functional/Fixtures/records.typoscript',
129  'EXT:seo/Tests/Functional/Fixtures/sitemap-xsl3.typoscript'
130  ],
131  'records',
132  '\/typo3\/sysext\/seo\/Tests\/Functional\/Fixtures\/XslFile3.xsl'
133  ],
134  [
135  [
136  'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
137  'EXT:seo/Tests/Functional/Fixtures/records.typoscript',
138  'EXT:seo/Tests/Functional/Fixtures/sitemap-xsl3.typoscript'
139  ],
140  'pages',
141  '\/typo3\/sysext\/seo\/Tests\/Functional\/Fixtures\/XslFile1.xsl'
142  ],
143  ];
144  }
145 }
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration
‪writeSiteConfiguration(string $identifier, array $site=[], array $languages=[], array $errorHandling=[])
Definition: SiteBasedTestTrait.php:58
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapXslTest\$configurationToUseInTestInstance
‪$configurationToUseInTestInstance
Definition: XmlSitemapXslTest.php:31
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\AbstractTestCase
Definition: AbstractTestCase.php:29
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap
Definition: AbstractXmlSitemapPagesTest.php:18
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapXslTest\getXslFilePaths
‪getXslFilePaths()
Definition: XmlSitemapXslTest.php:89
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildDefaultLanguageConfiguration
‪array buildDefaultLanguageConfiguration(string $identifier, string $base)
Definition: SiteBasedTestTrait.php:124
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapXslTest\$coreExtensionsToLoad
‪string[] $coreExtensionsToLoad
Definition: XmlSitemapXslTest.php:27
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapXslTest\checkIfDefaultSitemapReturnsDefaultXsl
‪checkIfDefaultSitemapReturnsDefaultXsl(array $typoscriptSetupFiles, string $sitemap, string $xslFilePath)
Definition: XmlSitemapXslTest.php:55
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration
‪array buildSiteConfiguration(int $rootPageId, string $base='')
Definition: SiteBasedTestTrait.php:109
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapXslTest
Definition: XmlSitemapXslTest.php:24
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapXslTest\setUp
‪setUp()
Definition: XmlSitemapXslTest.php:45