1 | <?php |
||
21 | class DsnTest extends TestCase |
||
22 | { |
||
23 | /** |
||
24 | * @covers ::__construct |
||
25 | * @covers ::parse |
||
26 | * @expectedException \InvalidArgumentException |
||
27 | */ |
||
28 | public function testDsnIsNotAString() |
||
33 | |||
34 | /** |
||
35 | * @covers ::__construct |
||
36 | * @covers ::<private> |
||
37 | * @expectedException \InvalidArgumentException |
||
38 | */ |
||
39 | public function testInvalidDsn() |
||
44 | |||
45 | /** |
||
46 | * @covers ::__construct |
||
47 | * @covers ::<private> |
||
48 | * @expectedException \InvalidArgumentException |
||
49 | */ |
||
50 | public function testInvalidScheme() |
||
55 | |||
56 | /** |
||
57 | * @covers ::__construct |
||
58 | * @covers ::getScheme |
||
59 | * @covers ::<private> |
||
60 | * @expectedException \InvalidArgumentException |
||
61 | */ |
||
62 | public function testInvalidKeyValuePair() |
||
67 | |||
68 | /** |
||
69 | * @covers ::__construct |
||
70 | * @covers ::__toString |
||
71 | * @covers ::getScheme |
||
72 | * @covers ::getUsername |
||
73 | * @covers ::getPassword |
||
74 | * @covers ::getPort |
||
75 | * @covers ::getHost |
||
76 | * @covers ::getPath |
||
77 | * @covers ::getQuery |
||
78 | * @covers ::getParameters |
||
79 | * @covers ::<private> |
||
80 | * @uses \phpDocumentor\DomainModel\Path |
||
81 | */ |
||
82 | public function testValidDsnWithScheme() |
||
106 | |||
107 | /** |
||
108 | * @covers ::__construct |
||
109 | * @covers ::__toString |
||
110 | * @covers ::getScheme |
||
111 | * @covers ::getHost |
||
112 | * @covers ::getPort |
||
113 | * @covers ::getPath |
||
114 | * @covers ::<private> |
||
115 | * @uses \phpDocumentor\DomainModel\Path |
||
116 | */ |
||
117 | public function testValidDsnWithoutScheme() |
||
128 | |||
129 | /** |
||
130 | * @covers ::__construct |
||
131 | * @covers ::__toString |
||
132 | * @covers ::getScheme |
||
133 | * @covers ::getHost |
||
134 | * @covers ::getPort |
||
135 | * @covers ::getPath |
||
136 | * @covers ::<private> |
||
137 | * @uses \phpDocumentor\DomainModel\Path |
||
138 | */ |
||
139 | public function testValidWindowsDsnWithoutScheme() |
||
140 | { |
||
141 | $dsn = "C:\\phpdocumentor\\tests\\unit\\phpDocumentor\\Infrastructure\\Parser"; |
||
142 | $fixture = new Dsn($dsn); |
||
143 | |||
144 | $this->assertEquals('file://C:\\phpdocumentor\\tests\\unit\\phpDocumentor\\Infrastructure\\Parser', (string)$fixture); |
||
145 | $this->assertEquals('file', $fixture->getscheme()); |
||
146 | $this->assertEquals(null, $fixture->getHost()); |
||
147 | $this->assertEquals(0, $fixture->getPort()); |
||
148 | $this->assertEquals('C:\\phpdocumentor\\tests\\unit\\phpDocumentor\\Infrastructure\\Parser', $fixture->getPath()); |
||
149 | } |
||
150 | |||
151 | /** |
||
152 | * @covers ::__construct |
||
153 | * @covers ::__toString |
||
154 | * @covers ::getScheme |
||
155 | * @covers ::getHost |
||
156 | * @covers ::getPort |
||
157 | * @covers ::getPath |
||
158 | * @covers ::<private> |
||
159 | * @uses \phpDocumentor\DomainModel\Path |
||
160 | */ |
||
161 | public function testValidWindowsDsnWithScheme() |
||
162 | { |
||
163 | $dsn = "file://C:\\phpdocumentor\\tests"; |
||
164 | $fixture = new Dsn($dsn); |
||
165 | |||
166 | $this->assertEquals('file://C:\\phpdocumentor\\tests', (string)$fixture); |
||
167 | $this->assertEquals('file', $fixture->getscheme()); |
||
168 | $this->assertEquals(null, $fixture->getHost()); |
||
169 | $this->assertEquals(0, $fixture->getPort()); |
||
170 | $this->assertEquals('C:\\phpdocumentor\\tests', $fixture->getPath()); |
||
171 | } |
||
172 | |||
173 | |||
174 | /** |
||
175 | * @covers ::__construct |
||
176 | * @covers ::getScheme |
||
177 | * @covers ::getPort |
||
178 | * @covers ::<private> |
||
179 | */ |
||
180 | public function testCorrectDefaultPorts() |
||
190 | } |
||
191 |