Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Add request object to Canonical Tag generation link
The PSR-14 ModifyUrlForCanonicalTagEvent was one of the first PSR-14 events to be added to TYPO3 Core, and was rather useless, as it did not contain the context to deal with creating a URl for the canonical tag. In order to make it useful, some more information is added to the Event object. This is a pre-cursor for a breaking change, for issue #99807. Resolves: #102001 Related: #99807 Releases: main, 12.4 Change-Id: Iebab3af3e9408ea82c95e1ad2cfdadc4a72c4a1d Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82021 Tested-by: core-ci <typo3@b13.com> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Benni Mack <benni@typo3.org>
- Loading branch information
Showing
5 changed files
with
103 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
typo3/sysext/seo/Tests/Unit/Event/ModifyUrlForCanonicalTagEventTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace TYPO3\CMS\Seo\Tests\Unit\Event; | ||
|
||
use TYPO3\CMS\Core\Domain\Page; | ||
use TYPO3\CMS\Core\Http\ServerRequest; | ||
use TYPO3\CMS\Core\Http\Uri; | ||
use TYPO3\CMS\Seo\Event\ModifyUrlForCanonicalTagEvent; | ||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase; | ||
|
||
final class ModifyUrlForCanonicalTagEventTest extends UnitTestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function gettersReturnInitializedObjects(): void | ||
{ | ||
$url = (string)new Uri('https://example.com'); | ||
$request = (new ServerRequest($url)); | ||
$page = new Page(['uid' => 123]); | ||
$event = new ModifyUrlForCanonicalTagEvent($url, $request, $page); | ||
|
||
self::assertEquals($url, $event->getUrl()); | ||
self::assertEquals($request, $event->getRequest()); | ||
self::assertEquals($page, $event->getPage()); | ||
} | ||
} |