[TASK] Shorten the extend class in all unit tests
[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 with protocol' => [
32 [
33 'email' => 'mailto:one@love.com'
34 ],
35 [
36 'email' => 'one@love.com'
37 ],
38 'mailto:one@love.com'
39 ],
40 'email with protocol 2' => [
41 [
42 'email' => 'mailto:info@typo3.org'
43 ],
44 [
45 'email' => 'info@typo3.org'
46 ],
47 'mailto:info@typo3.org'
48 ],
49 ];
50 }
51
52 /**
53 * @test
54 *
55 * @param string $input
56 * @param array $expected
57 * @param string $finalString
58 *
59 * @dataProvider resolveParametersForNonFilesDataProvider
60 */
61 public function resolveReturnsSplitParameters($input, $expected, $finalString)
62 {
63 $subject = new EmailLinkHandler();
64 $this->assertEquals($expected, $subject->resolveHandlerData($input));
65 }
66
67 /**
68 * @test
69 *
70 * @param string $input
71 * @param array $parameters
72 * @param string $expected
73 *
74 * @dataProvider resolveParametersForNonFilesDataProvider
75 */
76 public function splitParametersToUnifiedIdentifier($input, $parameters, $expected)
77 {
78 $subject = new EmailLinkHandler();
79 $this->assertEquals($expected, $subject->asString($parameters));
80 }
81 }