2 declare(strict_types = 1);
20 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
36 protected function setUp()
39 $this->importDataSet(
'EXT:seo/Tests/Functional/Fixtures/pages-sitemap.xml');
40 $this->importDataSet(
'EXT:seo/Tests/Functional/Fixtures/sys_category.xml');
41 $this->setUpFrontendRootPage(
44 'constants' => [
'EXT:seo/Configuration/TypoScript/XmlSitemap/constants.typoscript'],
46 'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript',
47 'EXT:seo/Tests/Functional/Fixtures/records.typoscript',
71 $response = $this->executeFrontendRequest(
72 (
new InternalRequest($host))->withQueryParameters(
75 'sitemap' =>
'records',
80 $this->assertEquals(200, $response->getStatusCode());
81 $this->assertArrayHasKey(
'Content-Length', $response->getHeaders());
82 $this->assertEquals(
'application/xml;charset=utf-8', $response->getHeader(
'Content-Type')[0]);
83 $this->assertArrayHasKey(
'X-Robots-Tag', $response->getHeaders());
84 $this->assertEquals(
'noindex', $response->getHeader(
'X-Robots-Tag')[0]);
85 $this->assertArrayHasKey(
'Content-Length', $response->getHeaders());
86 $stream = $response->getBody();
88 $content = $stream->getContents();
90 foreach ($expectedEntries as $expectedEntry) {
91 self::assertContains($expectedEntry, $content);
94 foreach ($notExpectedEntries as $notExpectedEntry) {
95 self::assertNotContains($notExpectedEntry, $content);
98 $this->assertGreaterThan(0, $response->getHeader(
'Content-Length')[0]);
107 'default-language' => [
110 'http://localhost/?tx_example_category%5Bid%5D=1&',
111 'http://localhost/?tx_example_category%5Bid%5D=2&',
114 'http://localhost/?tx_example_category%5Bid%5D=3&',
115 'http://localhost/fr/?tx_example_category%5Bid%5D=3&',
118 'french-language' => [
119 'http://localhost/fr',
121 'http://localhost/fr/?tx_example_category%5Bid%5D=3&',
124 'http://localhost/fr/?tx_example_category%5Bid%5D=1&',
125 'http://localhost/fr/?tx_example_category%5Bid%5D=2&',
126 'http://localhost/?tx_example_category%5Bid%5D=1&',
127 'http://localhost/?tx_example_category%5Bid%5D=2&',
142 $response = $this->executeFrontendRequest(
143 (
new InternalRequest(
'http://localhost/'))->withQueryParameters(
146 'type' => 1533906435,
147 'sitemap' => $sitemap,
152 $this->assertEquals(200, $response->getStatusCode());
153 $this->assertArrayHasKey(
'Content-Length', $response->getHeaders());
154 $stream = $response->getBody();
156 $content = $stream->getContents();
158 foreach ($expectedEntries as $expectedEntry) {
159 self::assertStringContainsString($expectedEntry, $content);
162 foreach ($notExpectedEntries as $notExpectedEntry) {
163 self::assertStringNotContainsString($notExpectedEntry, $content);
166 $this->assertGreaterThan(0, $response->getHeader(
'Content-Length')[0]);
176 'records_with_additional_where',
178 'http://localhost/?tx_example_category%5Bid%5D=1&',
181 'http://localhost/?tx_example_category%5Bid%5D=2&',
182 'http://localhost/?tx_example_category%5Bid%5D=3&'
186 'records_with_additional_where_starting_with_logical_operator',
188 'http://localhost/?tx_example_category%5Bid%5D=2&',
191 'http://localhost/?tx_example_category%5Bid%5D=1&',
192 'http://localhost/?tx_example_category%5Bid%5D=3&'