Skip to content

Commit b45dd09

Browse files
author
Martin Brecht-Precht
committed
Added more tests.
1 parent 0df2d13 commit b45dd09

File tree

1 file changed

+69
-3
lines changed

1 file changed

+69
-3
lines changed

Diff for: test/UrlTest.php

+69-3
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,91 @@
1010
class UrlTest extends \PHPUnit_Framework_TestCase
1111
{
1212

13-
public function testInvalidArguments()
13+
public function testInvalidArgument1()
1414
{
1515
$this->setExpectedException(get_class(new \InvalidArgumentException()));
1616
new QueryParameter(1, 1);
17+
}
18+
19+
public function testInvalidArgument2()
20+
{
1721
$this->setExpectedException(get_class(new \InvalidArgumentException()));
1822
new QueryParameter('arg1', new \Exception());
23+
}
24+
25+
public function testInvalidArgument3()
26+
{
27+
$this->setExpectedException(get_class(new \InvalidArgumentException()));
1928
new Url(array());
29+
}
30+
31+
public function testInvalidArgument4()
32+
{
33+
$this->setExpectedException(get_class(new \InvalidArgumentException()));
2034
$url = new Url('https://john:[email protected]:8443/path/to/resource');
2135
$url->setScheme(1.4);
36+
}
37+
38+
public function testInvalidArgument5()
39+
{
40+
$this->setExpectedException(get_class(new \InvalidArgumentException()));
41+
$url = new Url('https://john:[email protected]:8443/path/to/resource');
2242
$url->setHostname(0);
43+
}
44+
45+
public function testInvalidArgument6()
46+
{
47+
$this->setExpectedException(get_class(new \InvalidArgumentException()));
48+
$url = new Url('https://john:[email protected]:8443/path/to/resource');
2349
$url->setPort('invalid');
50+
}
51+
52+
public function testInvalidArgument7()
53+
{
54+
$this->setExpectedException(get_class(new \InvalidArgumentException()));
55+
$url = new Url('https://john:[email protected]:8443/path/to/resource');
2456
$url->setPath(12);
25-
$url->setQueryParameters('asd');
57+
}
58+
59+
public function testInvalidArgument9()
60+
{
61+
$this->setExpectedException(get_class(new \InvalidArgumentException()));
62+
$url = new Url('https://john:[email protected]:8443/path/to/resource');
2663
$url->setQueryParameters(array('asd'));
27-
$url->setQueryParametersFromArray('asd');
64+
}
65+
66+
public function testInvalidArgument11()
67+
{
68+
$this->setExpectedException(get_class(new \InvalidArgumentException()));
69+
$url = new Url('https://john:[email protected]:8443/path/to/resource');
2870
$url->setQueryParametersFromArray(array(array()));
71+
}
72+
73+
public function testInvalidArgument12()
74+
{
75+
$this->setExpectedException(get_class(new \InvalidArgumentException()));
76+
$url = new Url('https://john:[email protected]:8443/path/to/resource');
2977
$url->removeQueryParameterByKey(1);
78+
}
79+
80+
public function testInvalidArgument13()
81+
{
82+
$this->setExpectedException(get_class(new \InvalidArgumentException()));
83+
$url = new Url('https://john:[email protected]:8443/path/to/resource');
3084
$url->setUsername(array());
85+
}
86+
87+
public function testInvalidArgument14()
88+
{
89+
$this->setExpectedException(get_class(new \InvalidArgumentException()));
90+
$url = new Url('https://john:[email protected]:8443/path/to/resource');
3191
$url->setPassword(array());
92+
}
93+
94+
public function testInvalidArgument15()
95+
{
96+
$this->setExpectedException(get_class(new \InvalidArgumentException()));
97+
$url = new Url('https://john:[email protected]:8443/path/to/resource');
3298
$url->setFragment(array());
3399
}
34100

0 commit comments

Comments
 (0)