[TASK] Shorten the extend class in all unit tests
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Utility / HttpUtilityTest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Unit\Utility;
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\TestingFramework\Core\Unit\UnitTestCase;
18
19 /**
20 * Testcase for class \TYPO3\CMS\Core\Utility\HttpUtility
21 */
22 class HttpUtilityTest extends UnitTestCase
23 {
24 /**
25 * @param array $urlParts
26 * @param string $expected
27 * @dataProvider isUrlBuiltCorrectlyDataProvider
28 * @test
29 */
30 public function isUrlBuiltCorrectly(array $urlParts, $expected)
31 {
32 $url = \TYPO3\CMS\Core\Utility\HttpUtility::buildUrl($urlParts);
33 $this->assertEquals($expected, $url);
34 }
35
36 /**
37 * @return array
38 */
39 public function isUrlBuiltCorrectlyDataProvider()
40 {
41 return [
42 'rebuild url without scheme' => [
43 parse_url('typo3.org/path/index.php'),
44 'typo3.org/path/index.php'
45 ],
46 'rebuild url with scheme' => [
47 parse_url('http://typo3.org/path/index.php'),
48 'http://typo3.org/path/index.php'
49 ],
50 'rebuild url with all properties' => [
51 parse_url('http://editor:secret@typo3.org:8080/path/index.php?query=data#fragment'),
52 'http://editor:secret@typo3.org:8080/path/index.php?query=data#fragment'
53 ],
54 'url without username, but password' => [
55 [
56 'scheme' => 'http',
57 'pass' => 'secrept',
58 'host' => 'typo3.org'
59 ],
60 'http://typo3.org'
61 ]
62 ];
63 }
64 }