‪TYPO3CMS  11.5
XmlSitemapIndexTest.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 
27 {
28  protected ‪$coreExtensionsToLoad = ['seo'];
29 
30  protected function ‪setUp(): void
31  {
32  parent::setUp();
33  $this->importCSVDataSet(__DIR__ . '/../Fixtures/pages-sitemap.csv');
34  $this->setUpFrontendRootPage(
35  1,
36  [
37  'constants' => ['EXT:seo/Configuration/TypoScript/XmlSitemap/constants.typoscript'],
38  'setup' => ['EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript'],
39  ]
40  );
41  }
42 
47  {
49  'website-local',
50  $this->‪buildSiteConfiguration(1, 'http://localhost/'),
51  [
52  $this->‪buildDefaultLanguageConfiguration('EN', '/'),
53  ]
54  );
55 
56  $response = $this->executeFrontendSubRequest(
57  (new InternalRequest('http://localhost/'))->withQueryParameters([
58  'id' => 1,
59  'type' => 1533906435,
60  ])
61  );
62 
63  self::assertEquals(200, $response->getStatusCode());
64  self::assertArrayHasKey('Content-Length', $response->getHeaders());
65  self::assertGreaterThan(0, $response->getHeader('Content-Length')[0]);
66  self::assertArrayHasKey('Content-Type', $response->getHeaders());
67  self::assertEquals('application/xml;charset=utf-8', $response->getHeader('Content-Type')[0]);
68  self::assertArrayHasKey('X-Robots-Tag', $response->getHeaders());
69  self::assertEquals('noindex', $response->getHeader('X-Robots-Tag')[0]);
70  self::assertMatchesRegularExpression('/<loc>http:\/\/localhost\/\?sitemap=pages&amp;type=1533906435&amp;cHash=[^<]+<\/loc>/', (string)$response->getBody());
71  }
72 }
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapIndexTest\checkIfSiteMapIndexContainsPagesSitemap
‪checkIfSiteMapIndexContainsPagesSitemap()
Definition: XmlSitemapIndexTest.php:46
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapIndexTest
Definition: XmlSitemapIndexTest.php:27
‪TYPO3\CMS\Seo\Tests\Functional\XmlSitemap\XmlSitemapIndexTest\setUp
‪setUp()
Definition: XmlSitemapIndexTest.php:30
‪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\XmlSitemapIndexTest\$coreExtensionsToLoad
‪$coreExtensionsToLoad
Definition: XmlSitemapIndexTest.php:28
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration
‪array buildSiteConfiguration(int $rootPageId, string $base='')
Definition: SiteBasedTestTrait.php:111