Repository navigation
Expand file tree
/
Copy pathUriTest.php
More file actions
72 lines (58 loc) · 2.19 KB
/
Copy pathUriTest.php
File metadata and controls
72 lines (58 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
namespace Codeception\Util;
class UriTest extends \Codeception\Test\Unit
{
// tests
public function testUrlMerge()
{
$this->assertEquals(
'http://codeception.com/quickstart',
Uri::mergeUrls('http://codeception.com/hello', '/quickstart'),
'merge paths'
);
$this->assertEquals(
'http://codeception.com/hello/davert',
Uri::mergeUrls('http://codeception.com/hello/world', 'davert'),
'merge relative urls'
);
$this->assertEquals(
'https://github.com/codeception/codeception',
Uri::mergeUrls('http://codeception.com/hello/world', 'https://github.com/codeception/codeception'),
'merge absolute urls'
);
}
/**
* @Issue https://github.com/Codeception/Codeception/pull/2141
*/
public function testMergingScheme()
{
$this->assertEquals('https://google.com/account/', Uri::mergeUrls('http://google.com/', 'https://google.com/account/'));
}
/**
* @Issue https://github.com/Codeception/Codeception/pull/2499
*/
public function testAppendAnchor()
{
$this->assertEquals('http://codeception.com/quickstart#anchor',
Uri::appendPath('http://codeception.com/quickstart', '#anchor'));
$this->assertEquals('http://codeception.com/quickstart#anchor',
Uri::appendPath('http://codeception.com/quickstart#first', '#anchor'));
}
public function testAppendPath()
{
$this->assertEquals('http://codeception.com/quickstart/path',
Uri::appendPath('http://codeception.com/quickstart', 'path'));
$this->assertEquals('http://codeception.com/quickstart/path',
Uri::appendPath('http://codeception.com/quickstart', '/path'));
}
public function testAppendEmptyPath()
{
$this->assertEquals('http://codeception.com/quickstart',
Uri::appendPath('http://codeception.com/quickstart', ''));
}
public function testAppendPathRemovesQueryStringAndAnchor()
{
$this->assertEquals('http://codeception.com/quickstart',
Uri::appendPath('http://codeception.com/quickstart?a=b#c', ''));
}
}