[BUGFIX] Fix TEXT value property type in t3editor
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / LinkHandling / EmailLinkHandlerTest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Unit\LinkHandling;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Core\LinkHandling\EmailLinkHandler;
18 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
19
20 class EmailLinkHandlerTest extends UnitTestCase
21 {
22
23 /**
24 * Data to resolve strings to arrays and vice versa, external, mail, page
25 *
26 * @return array
27 */
28 public function resolveParametersForNonFilesDataProvider()
29 {
30 return [
31 'email without protocol' => [
32 [
33 'email' => 'one@example.com'
34 ],
35 [
36 'email' => 'one@example.com'
37 ],
38 'mailto:one@example.com'
39 ],
40 'email with protocol' => [
41 [
42 'email' => 'mailto:one@example.com'
43 ],
44 [
45 'email' => 'one@example.com'
46 ],
47 'mailto:one@example.com'
48 ],
49 'email with protocol 2' => [
50 [
51 'email' => 'mailto:info@example.org'
52 ],
53 [
54 'email' => 'info@example.org'
55 ],
56 'mailto:info@example.org'
57 ],
58 ];
59 }
60
61 /**
62 * @test
63 *
64 * @param string $input
65 * @param array $expected
66 * @param string $finalString
67 *
68 * @dataProvider resolveParametersForNonFilesDataProvider
69 */
70 public function resolveReturnsSplitParameters($input, $expected, $finalString)
71 {
72 $subject = new EmailLinkHandler();
73 $this->assertEquals($expected, $subject->resolveHandlerData($input));
74 }
75
76 /**
77 * @test
78 *
79 * @param string $input
80 * @param array $parameters
81 * @param string $expected
82 *
83 * @dataProvider resolveParametersForNonFilesDataProvider
84 */
85 public function splitParametersToUnifiedIdentifier($input, $parameters, $expected)
86 {
87 $subject = new EmailLinkHandler();
88 $this->assertEquals($expected, $subject->asString($parameters));
89 }
90 }