‪TYPO3CMS  11.5
CheckBrokenRteLinkEventListenerTest.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 
23 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
24 
25 class ‪CheckBrokenRteLinkEventListenerTest extends FunctionalTestCase
26 {
28 
29  protected function ‪setUp(): void
30  {
31  parent::setUp();
32  $this->subject = new ‪CheckBrokenRteLinkEventListener(
34  );
35  }
36 
41  public function ‪checkPageLinkTest(string $linkType, array $linkData, bool $isMarkedAsBroken): void
42  {
43  $this->importDataSet('PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/pages.xml');
44 
45  $event = new ‪BrokenLinkAnalysisEvent(
46  $linkType,
47  $linkData
48  );
49 
50  $this->subject->checkPageLink($event);
51  self::assertEquals($isMarkedAsBroken, $event->isBrokenLink());
52  }
53 
54  public function ‪checkPageLinkTestDataProvider(): \Generator
55  {
56  yield 'No uid parameter given' => [
57  'page',
58  [
59  'parameters' => 'alias=-',
60  'type' => 'page',
61  ],
62  false,
63  ];
64  yield 'Page exist' => [
65  'page',
66  [
67  'parameters' => 'alias=foo',
68  'pageuid' => '2',
69  'type' => 'page',
70  ],
71  false,
72  ];
73  yield 'Page not found' => [
74  'page',
75  [
76  'parameters' => 'alias=foo',
77  'pageuid' => '12345',
78  'type' => 'page',
79  ],
80  true,
81  ];
82  }
83 }
‪TYPO3\CMS\Linkvalidator\Tests\Functional\EventListener\CheckBrokenRteLinkEventListenerTest\$subject
‪CheckBrokenRteLinkEventListener $subject
Definition: CheckBrokenRteLinkEventListenerTest.php:27
‪TYPO3\CMS\Linkvalidator\Tests\Functional\EventListener\CheckBrokenRteLinkEventListenerTest\setUp
‪setUp()
Definition: CheckBrokenRteLinkEventListenerTest.php:29
‪TYPO3\CMS\Linkvalidator\Tests\Functional\EventListener\CheckBrokenRteLinkEventListenerTest\checkPageLinkTestDataProvider
‪checkPageLinkTestDataProvider()
Definition: CheckBrokenRteLinkEventListenerTest.php:54
‪TYPO3\CMS\Linkvalidator\Tests\Functional\EventListener\CheckBrokenRteLinkEventListenerTest\checkPageLinkTest
‪checkPageLinkTest(string $linkType, array $linkData, bool $isMarkedAsBroken)
Definition: CheckBrokenRteLinkEventListenerTest.php:41
‪TYPO3\CMS\Linkvalidator\Tests\Functional\EventListener\CheckBrokenRteLinkEventListenerTest
Definition: CheckBrokenRteLinkEventListenerTest.php:26
‪TYPO3\CMS\Linkvalidator\Tests\Functional\EventListener
Definition: CheckBrokenRteLinkEventListenerTest.php:18