|
14 | 14 | *
|
15 | 15 | */
|
16 | 16 |
|
| 17 | +use TYPO3\CMS\Core\Package\Cache\PackageCacheInterface; |
| 18 | + |
17 | 19 | class RenderingTest extends AbstractRenderingTestCase
|
18 | 20 | {
|
19 | 21 | /**
|
20 | 22 | * @test
|
21 | 23 | */
|
22 |
| - public function urlGeneratedRespectAbsRefPrefixAndLinkVarsAndTarget() |
| 24 | + public function urlGeneratedRespectAbsRefPrefixAndLinkVarsAndTarget(): void |
23 | 25 | {
|
24 | 26 | $requestArguments = ['url' => $this->getRenderUrl(1, 1, 'lib.link')];
|
25 |
| - $expectedContent = '<a href="/index.php?id=1&L=1" target="_blank">link</a>'; |
26 |
| - $this->assertSame($expectedContent, trim($this->fetchFrontendResponse($requestArguments)->getContent())); |
| 27 | + $expectedContent = '<a href="/da/" target="_blank">link</a>'; |
| 28 | + $actualContent = trim($this->fetchFrontendResponse($requestArguments)->getContent()); |
| 29 | + $this->assertSame($expectedContent, $actualContent); |
27 | 30 | }
|
28 | 31 |
|
29 | 32 | /**
|
30 | 33 | * @test
|
31 | 34 | */
|
32 |
| - public function emailViewHelperWorksAlsoWithSpamProtection() |
| 35 | + public function emailViewHelperWorksAlsoWithSpamProtection(): void |
33 | 36 | {
|
34 | 37 | $requestArguments = ['url' => $this->getRenderUrl(1, 1, 'lib.fluid')];
|
35 |
| - $expectedContent = '<a href="javascript:linkTo_UnCryptMailto(\'ocknvq,kphqBjgnjwo0kq\');">info(AT)helhum(DOT)io</a>'; |
36 |
| - $this->assertSame($expectedContent, trim($this->fetchFrontendResponse($requestArguments)->getContent())); |
| 38 | + $expectedContent = '<a href="#" data-mailto-token="ocknvq,kphqBjgnjwo0kq" data-mailto-vector="2">info(AT)helhum(DOT)io</a>'; |
| 39 | + if (!interface_exists(PackageCacheInterface::class)) { |
| 40 | + $expectedContent = '<a href="javascript:linkTo_UnCryptMailto(%27ocknvq%2CkphqBjgnjwo0kq%27);">info(AT)helhum(DOT)io</a>'; |
| 41 | + } |
| 42 | + $actualContent = trim($this->fetchFrontendResponse($requestArguments)->getContent()); |
| 43 | + $this->assertSame($expectedContent, $actualContent); |
37 | 44 | }
|
38 | 45 |
|
39 | 46 | /**
|
40 | 47 | * @test
|
41 | 48 | */
|
42 |
| - public function viewHelperOutputsUri() |
| 49 | + public function viewHelperOutputsUri(): void |
43 | 50 | {
|
44 | 51 | $requestArguments = ['url' => $this->getRenderUrl(1, 1, 'lib.viewHelper')];
|
45 |
| - $actualContentWithoutCHash = preg_replace('/&cHash=[a-z0-9]*/', '', trim($this->fetchFrontendResponse($requestArguments)->getContent())); |
46 |
| - $expectedContent = '/index.php?id=1&L=1&tx_typoscriptrendering%5Bcontext%5D=%7B%22record%22%3A%22pages_1%22%2C%22path%22%3A%22tt_content.typoscriptrendering_plugintest.20%22%7D&tx_typoscriptrendering_plugintest%5Bcontroller%5D=Foo'; |
47 |
| - $this->assertSame($expectedContent, $actualContentWithoutCHash); |
| 52 | + $expectedContent = '/da/?tx_typoscriptrendering%5Bcontext%5D=%7B%22record%22%3A%22pages_1%22%2C%22path%22%3A%22tt_content.typoscriptrendering_plugintest.20%22%7D&tx_typoscriptrendering_plugintest%5Bcontroller%5D=Foo&cHash=05eba63c2a1d73fbdb2e4702e42fab9e'; |
| 53 | + $actualContent = trim($this->fetchFrontendResponse($requestArguments)->getContent()); |
| 54 | + $this->assertSame($expectedContent, $actualContent); |
48 | 55 | }
|
49 | 56 |
|
50 | 57 | /**
|
51 | 58 | * @test
|
52 | 59 | */
|
53 |
| - public function cObjectUriViewHelperOutputsUri() |
| 60 | + public function cObjectUriViewHelperOutputsUri(): void |
54 | 61 | {
|
55 | 62 | $requestArguments = ['url' => $this->getRenderUrl(1, 1, 'lib.cObjectUriViewHelper')];
|
56 |
| - $actualContentWithoutCHash = preg_replace('/&cHash=[a-z0-9]*/', '', trim($this->fetchFrontendResponse($requestArguments)->getContent())); |
57 |
| - $expectedContent = '/index.php?id=1&L=1&tx_typoscriptrendering%5Bcontext%5D=%7B%22record%22%3A%22pages_1%22%2C%22path%22%3A%22lib.foo%22%7D'; |
58 |
| - $this->assertSame($expectedContent, $actualContentWithoutCHash); |
| 63 | + $expectedContent = '/da/?tx_typoscriptrendering%5Bcontext%5D=%7B%22record%22%3A%22pages_1%22%2C%22path%22%3A%22lib.foo%22%7D&cHash=cb0d36cfb1819138f899192eda25168e'; |
| 64 | + $actualContent = trim($this->fetchFrontendResponse($requestArguments)->getContent()); |
| 65 | + $this->assertSame($expectedContent, $actualContent); |
59 | 66 | }
|
60 | 67 |
|
61 | 68 | /**
|
62 | 69 | * @test
|
63 | 70 | */
|
64 |
| - public function cObjectLinkViewHelperOutputsUri() |
| 71 | + public function cObjectLinkViewHelperOutputsUri(): void |
65 | 72 | {
|
66 | 73 | $requestArguments = ['url' => $this->getRenderUrl(1, 1, 'lib.cObjectLinkViewHelper')];
|
67 |
| - $actualContentWithoutCHash = preg_replace('/&cHash=[a-z0-9]*/', '', trim($this->fetchFrontendResponse($requestArguments)->getContent())); |
68 |
| - $expectedContent = '<a href="/index.php?id=1&L=1&tx_typoscriptrendering%5Bcontext%5D=%7B%22record%22%3A%22pages_1%22%2C%22path%22%3A%22lib.foo%22%7D">Link</a>'; |
69 |
| - $this->assertSame($expectedContent, $actualContentWithoutCHash); |
| 74 | + $expectedContent = '<a href="/da/?tx_typoscriptrendering%5Bcontext%5D=%7B%22record%22%3A%22pages_1%22%2C%22path%22%3A%22lib.foo%22%7D&cHash=cb0d36cfb1819138f899192eda25168e">Link</a>'; |
| 75 | + $actualContent = trim($this->fetchFrontendResponse($requestArguments)->getContent()); |
| 76 | + $this->assertSame($expectedContent, $actualContent); |
70 | 77 | }
|
71 | 78 |
|
72 | 79 | /**
|
73 | 80 | * @test
|
74 | 81 | */
|
75 |
| - public function oldViewHelperOutputsUri() |
| 82 | + public function oldViewHelperOutputsUri(): void |
76 | 83 | {
|
77 | 84 | $requestArguments = ['url' => $this->getRenderUrl(1, 1, 'lib.oldViewHelper')];
|
78 |
| - $actualContentWithoutCHash = preg_replace('/&cHash=[a-z0-9]*/', '', trim($this->fetchFrontendResponse($requestArguments)->getContent())); |
79 |
| - $expectedContent = '/index.php?id=1&L=1&tx_typoscriptrendering%5Bcontext%5D=%7B%22record%22%3A%22pages_1%22%2C%22path%22%3A%22tt_content.typoscriptrendering_plugintest.20%22%7D&tx_typoscriptrendering_plugintest%5Bcontroller%5D=Foo'; |
80 |
| - $this->assertSame($expectedContent, $actualContentWithoutCHash); |
| 85 | + $expectedContent = '/da/?tx_typoscriptrendering%5Bcontext%5D=%7B%22record%22%3A%22pages_1%22%2C%22path%22%3A%22tt_content.typoscriptrendering_plugintest.20%22%7D&tx_typoscriptrendering_plugintest%5Bcontroller%5D=Foo&cHash=05eba63c2a1d73fbdb2e4702e42fab9e'; |
| 86 | + $actualContent = trim($this->fetchFrontendResponse($requestArguments)->getContent()); |
| 87 | + $this->assertSame($expectedContent, $actualContent); |
81 | 88 | }
|
82 | 89 |
|
83 | 90 | /**
|
84 | 91 | * @test
|
85 | 92 | */
|
86 |
| - public function linkViewHelperOutputsUri() |
| 93 | + public function linkViewHelperOutputsUri(): void |
87 | 94 | {
|
88 | 95 | $requestArguments = ['url' => $this->getRenderUrl(1, 1, 'lib.linkViewHelper')];
|
89 |
| - $actualContentWithoutCHash = preg_replace('/&cHash=[a-z0-9]*/', '', trim($this->fetchFrontendResponse($requestArguments)->getContent())); |
90 |
| - $expectedContent = '<a href="/index.php?id=1&L=1&tx_typoscriptrendering%5Bcontext%5D=%7B%22record%22%3A%22pages_1%22%2C%22path%22%3A%22tt_content.typoscriptrendering_plugintest.20%22%7D&tx_typoscriptrendering_plugintest%5Bcontroller%5D=Foo">Link</a>'; |
91 |
| - $this->assertSame($expectedContent, $actualContentWithoutCHash); |
| 96 | + $expectedContent = '<a href="/da/?tx_typoscriptrendering%5Bcontext%5D=%7B%22record%22%3A%22pages_1%22%2C%22path%22%3A%22tt_content.typoscriptrendering_plugintest.20%22%7D&tx_typoscriptrendering_plugintest%5Bcontroller%5D=Foo&cHash=05eba63c2a1d73fbdb2e4702e42fab9e">Link</a>'; |
| 97 | + $actualContent = trim($this->fetchFrontendResponse($requestArguments)->getContent()); |
| 98 | + $this->assertSame($expectedContent, $actualContent); |
92 | 99 | }
|
93 | 100 | }
|
0 commit comments