Completed
Push — master ( fcb010...ba73f2 )
by Martijn
19s
created
tests/Parser/Php/PreprocessorTest.php 1 patch
Indentation   +274 added lines, -274 removed lines patch added patch discarded remove patch
@@ -6,42 +6,42 @@  discard block
 block discarded – undo
6 6
 class PreprocessorTest extends TestCase
7 7
 {
8 8
 
9
-    /**
10
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::__construct
11
-     */
12
-    public function testConstructor_Empty()
13
-    {
14
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
15
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
16
-    }
17
-
18
-    /**
19
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::__construct
20
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::getPrefix
21
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::setPrefix
22
-     */
23
-    public function testConstructor_Prefix()
24
-    {
25
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
26
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
27
-        $this->assertEquals('rest', $object->getPrefix());
28
-
29
-        $object = new \SwaggerGen\Parser\Php\Preprocessor('foo');
30
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
31
-        $this->assertEquals('foo', $object->getPrefix());
32
-
33
-        $object->setPrefix('bar');
34
-        $this->assertEquals('bar', $object->getPrefix());
35
-    }
36
-
37
-    /**
38
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
39
-     */
40
-    public function testPreprocess_Ifdef_NotDefined()
41
-    {
42
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
43
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
44
-        $out = $object->preprocess('<?php
9
+	/**
10
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::__construct
11
+	 */
12
+	public function testConstructor_Empty()
13
+	{
14
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
15
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
16
+	}
17
+
18
+	/**
19
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::__construct
20
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::getPrefix
21
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::setPrefix
22
+	 */
23
+	public function testConstructor_Prefix()
24
+	{
25
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
26
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
27
+		$this->assertEquals('rest', $object->getPrefix());
28
+
29
+		$object = new \SwaggerGen\Parser\Php\Preprocessor('foo');
30
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
31
+		$this->assertEquals('foo', $object->getPrefix());
32
+
33
+		$object->setPrefix('bar');
34
+		$this->assertEquals('bar', $object->getPrefix());
35
+	}
36
+
37
+	/**
38
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
39
+	 */
40
+	public function testPreprocess_Ifdef_NotDefined()
41
+	{
42
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
43
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
44
+		$out = $object->preprocess('<?php
45 45
 			/**
46 46
 			 * @rest\ifdef test
47 47
 			 * @rest\whatever
@@ -49,25 +49,25 @@  discard block
 block discarded – undo
49 49
 			 */
50 50
 		');
51 51
 
52
-        $this->assertEquals('<?php
52
+		$this->assertEquals('<?php
53 53
 			/**
54 54
 			 * @!rest\ifdef test
55 55
 			 * @!rest\whatever
56 56
 			 * @!rest\endif
57 57
 			 */
58 58
 		', $out);
59
-    }
60
-
61
-    /**
62
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
63
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
64
-     */
65
-    public function testPreprocess_Ifdef_Defined()
66
-    {
67
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
68
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
69
-        $object->define('test');
70
-        $out = $object->preprocess('<?php
59
+	}
60
+
61
+	/**
62
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
63
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
64
+	 */
65
+	public function testPreprocess_Ifdef_Defined()
66
+	{
67
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
68
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
69
+		$object->define('test');
70
+		$out = $object->preprocess('<?php
71 71
 			/**
72 72
 			 * @rest\ifdef test
73 73
 			 * @rest\whatever
@@ -75,23 +75,23 @@  discard block
 block discarded – undo
75 75
 			 */
76 76
 		');
77 77
 
78
-        $this->assertEquals('<?php
78
+		$this->assertEquals('<?php
79 79
 			/**
80 80
 			 * @!rest\ifdef test
81 81
 			 * @rest\whatever
82 82
 			 * @!rest\endif
83 83
 			 */
84 84
 		', $out);
85
-    }
85
+	}
86 86
 
87
-    /**
88
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
89
-     */
90
-    public function testPreprocess_Ifndef_NotDefined()
91
-    {
92
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
93
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
94
-        $out = $object->preprocess('<?php
87
+	/**
88
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
89
+	 */
90
+	public function testPreprocess_Ifndef_NotDefined()
91
+	{
92
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
93
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
94
+		$out = $object->preprocess('<?php
95 95
 			/**
96 96
 			 * @rest\ifndef test
97 97
 			 * @rest\whatever
@@ -99,25 +99,25 @@  discard block
 block discarded – undo
99 99
 			 */
100 100
 		');
101 101
 
102
-        $this->assertEquals('<?php
102
+		$this->assertEquals('<?php
103 103
 			/**
104 104
 			 * @!rest\ifndef test
105 105
 			 * @rest\whatever
106 106
 			 * @!rest\endif
107 107
 			 */
108 108
 		', $out);
109
-    }
110
-
111
-    /**
112
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
113
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
114
-     */
115
-    public function testPreprocess_Ifndef_Defined()
116
-    {
117
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
118
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
119
-        $object->define('test');
120
-        $out = $object->preprocess('<?php
109
+	}
110
+
111
+	/**
112
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
113
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
114
+	 */
115
+	public function testPreprocess_Ifndef_Defined()
116
+	{
117
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
118
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
119
+		$object->define('test');
120
+		$out = $object->preprocess('<?php
121 121
 			/**
122 122
 			 * @rest\ifndef test
123 123
 			 * @rest\whatever
@@ -125,23 +125,23 @@  discard block
 block discarded – undo
125 125
 			 */
126 126
 		');
127 127
 
128
-        $this->assertEquals('<?php
128
+		$this->assertEquals('<?php
129 129
 			/**
130 130
 			 * @!rest\ifndef test
131 131
 			 * @!rest\whatever
132 132
 			 * @!rest\endif
133 133
 			 */
134 134
 		', $out);
135
-    }
135
+	}
136 136
 
137
-    /**
138
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
139
-     */
140
-    public function testPreprocess_Define()
141
-    {
142
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
143
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
144
-        $out = $object->preprocess('<?php
137
+	/**
138
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
139
+	 */
140
+	public function testPreprocess_Define()
141
+	{
142
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
143
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
144
+		$out = $object->preprocess('<?php
145 145
 			/**
146 146
 			 * @rest\define test
147 147
 			 * @rest\ifndef test
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			 */
151 151
 		');
152 152
 
153
-        $this->assertEquals('<?php
153
+		$this->assertEquals('<?php
154 154
 			/**
155 155
 			 * @!rest\define test
156 156
 			 * @!rest\ifndef test
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 			 * @!rest\endif
159 159
 			 */
160 160
 		', $out);
161
-    }
161
+	}
162 162
 
163
-    /**
164
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
165
-     */
166
-    public function testPreprocess_Undef()
167
-    {
168
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
169
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
170
-        $out = $object->preprocess('<?php
163
+	/**
164
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
165
+	 */
166
+	public function testPreprocess_Undef()
167
+	{
168
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
169
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
170
+		$out = $object->preprocess('<?php
171 171
 			/**
172 172
 			 * @rest\define test
173 173
 			 * @rest\undef test
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			 */
178 178
 		');
179 179
 
180
-        $this->assertEquals('<?php
180
+		$this->assertEquals('<?php
181 181
 			/**
182 182
 			 * @!rest\define test
183 183
 			 * @!rest\undef test
@@ -186,16 +186,16 @@  discard block
 block discarded – undo
186 186
 			 * @!rest\endif
187 187
 			 */
188 188
 		', $out);
189
-    }
189
+	}
190 190
 
191
-    /**
192
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
193
-     */
194
-    public function testPreprocess_If_NotDefined()
195
-    {
196
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
197
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
198
-        $out = $object->preprocess('<?php
191
+	/**
192
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
193
+	 */
194
+	public function testPreprocess_If_NotDefined()
195
+	{
196
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
197
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
198
+		$out = $object->preprocess('<?php
199 199
 			/**
200 200
 			 * @rest\if test red
201 201
 			 * @rest\whatever
@@ -203,25 +203,25 @@  discard block
 block discarded – undo
203 203
 			 */
204 204
 		');
205 205
 
206
-        $this->assertEquals('<?php
206
+		$this->assertEquals('<?php
207 207
 			/**
208 208
 			 * @!rest\if test red
209 209
 			 * @!rest\whatever
210 210
 			 * @!rest\endif
211 211
 			 */
212 212
 		', $out);
213
-    }
214
-
215
-    /**
216
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
217
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
218
-     */
219
-    public function testPreprocess_If_AnyValue()
220
-    {
221
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
222
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
223
-        $object->define('test', 'green');
224
-        $out = $object->preprocess('<?php
213
+	}
214
+
215
+	/**
216
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
217
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
218
+	 */
219
+	public function testPreprocess_If_AnyValue()
220
+	{
221
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
222
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
223
+		$object->define('test', 'green');
224
+		$out = $object->preprocess('<?php
225 225
 			/**
226 226
 			 * @rest\if test
227 227
 			 * @rest\whatever
@@ -229,25 +229,25 @@  discard block
 block discarded – undo
229 229
 			 */
230 230
 		');
231 231
 
232
-        $this->assertEquals('<?php
232
+		$this->assertEquals('<?php
233 233
 			/**
234 234
 			 * @!rest\if test
235 235
 			 * @rest\whatever
236 236
 			 * @!rest\endif
237 237
 			 */
238 238
 		', $out);
239
-    }
240
-
241
-    /**
242
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
243
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
244
-     */
245
-    public function testPreprocess_If_NoValue()
246
-    {
247
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
248
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
249
-        $object->define('test');
250
-        $out = $object->preprocess('<?php
239
+	}
240
+
241
+	/**
242
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
243
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
244
+	 */
245
+	public function testPreprocess_If_NoValue()
246
+	{
247
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
248
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
249
+		$object->define('test');
250
+		$out = $object->preprocess('<?php
251 251
 			/**
252 252
 			 * @rest\if test red
253 253
 			 * @rest\whatever
@@ -255,25 +255,25 @@  discard block
 block discarded – undo
255 255
 			 */
256 256
 		');
257 257
 
258
-        $this->assertEquals('<?php
258
+		$this->assertEquals('<?php
259 259
 			/**
260 260
 			 * @!rest\if test red
261 261
 			 * @!rest\whatever
262 262
 			 * @!rest\endif
263 263
 			 */
264 264
 		', $out);
265
-    }
266
-
267
-    /**
268
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
269
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
270
-     */
271
-    public function testPreprocess_If_Mismatch()
272
-    {
273
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
274
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
275
-        $object->define('test', 'green');
276
-        $out = $object->preprocess('<?php
265
+	}
266
+
267
+	/**
268
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
269
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
270
+	 */
271
+	public function testPreprocess_If_Mismatch()
272
+	{
273
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
274
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
275
+		$object->define('test', 'green');
276
+		$out = $object->preprocess('<?php
277 277
 			/**
278 278
 			 * @rest\if test red
279 279
 			 * @rest\whatever
@@ -281,25 +281,25 @@  discard block
 block discarded – undo
281 281
 			 */
282 282
 		');
283 283
 
284
-        $this->assertEquals('<?php
284
+		$this->assertEquals('<?php
285 285
 			/**
286 286
 			 * @!rest\if test red
287 287
 			 * @!rest\whatever
288 288
 			 * @!rest\endif
289 289
 			 */
290 290
 		', $out);
291
-    }
292
-
293
-    /**
294
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
295
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
296
-     */
297
-    public function testPreprocess_If_Match()
298
-    {
299
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
300
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
301
-        $object->define('test', 'red');
302
-        $out = $object->preprocess('<?php
291
+	}
292
+
293
+	/**
294
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
295
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
296
+	 */
297
+	public function testPreprocess_If_Match()
298
+	{
299
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
300
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
301
+		$object->define('test', 'red');
302
+		$out = $object->preprocess('<?php
303 303
 			/**
304 304
 			 * @rest\if test red
305 305
 			 * @rest\whatever
@@ -307,25 +307,25 @@  discard block
 block discarded – undo
307 307
 			 */
308 308
 		');
309 309
 
310
-        $this->assertEquals('<?php
310
+		$this->assertEquals('<?php
311 311
 			/**
312 312
 			 * @!rest\if test red
313 313
 			 * @rest\whatever
314 314
 			 * @!rest\endif
315 315
 			 */
316 316
 		', $out);
317
-    }
318
-
319
-    /**
320
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
321
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
322
-     */
323
-    public function testPreprocess_Else_Match()
324
-    {
325
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
326
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
327
-        $object->define('test', 'blue');
328
-        $out = $object->preprocess('<?php
317
+	}
318
+
319
+	/**
320
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
321
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
322
+	 */
323
+	public function testPreprocess_Else_Match()
324
+	{
325
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
326
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
327
+		$object->define('test', 'blue');
328
+		$out = $object->preprocess('<?php
329 329
 			/**
330 330
 			 * @rest\if test red
331 331
 			 * @rest\whatever
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			 */
336 336
 		');
337 337
 
338
-        $this->assertEquals('<?php
338
+		$this->assertEquals('<?php
339 339
 			/**
340 340
 			 * @!rest\if test red
341 341
 			 * @!rest\whatever
@@ -344,18 +344,18 @@  discard block
 block discarded – undo
344 344
 			 * @!rest\endif
345 345
 			 */
346 346
 		', $out);
347
-    }
348
-
349
-    /**
350
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
351
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
352
-     */
353
-    public function testPreprocess_Elif_Match()
354
-    {
355
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
356
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
357
-        $object->define('test', 'blue');
358
-        $out = $object->preprocess('<?php
347
+	}
348
+
349
+	/**
350
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
351
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
352
+	 */
353
+	public function testPreprocess_Elif_Match()
354
+	{
355
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
356
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
357
+		$object->define('test', 'blue');
358
+		$out = $object->preprocess('<?php
359 359
 			/**
360 360
 			 * @rest\if test red
361 361
 			 * @rest\whatever
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 			 */
368 368
 		');
369 369
 
370
-        $this->assertEquals('<?php
370
+		$this->assertEquals('<?php
371 371
 			/**
372 372
 			 * @!rest\if test red
373 373
 			 * @!rest\whatever
@@ -378,18 +378,18 @@  discard block
 block discarded – undo
378 378
 			 * @!rest\endif
379 379
 			 */
380 380
 		', $out);
381
-    }
382
-
383
-    /**
384
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
385
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
386
-     */
387
-    public function testPreprocess_Elif_NoValue()
388
-    {
389
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
390
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
391
-        $object->define('test', 'blue');
392
-        $out = $object->preprocess('<?php
381
+	}
382
+
383
+	/**
384
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
385
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
386
+	 */
387
+	public function testPreprocess_Elif_NoValue()
388
+	{
389
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
390
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
391
+		$object->define('test', 'blue');
392
+		$out = $object->preprocess('<?php
393 393
 			/**
394 394
 			 * @rest\if test red
395 395
 			 * @rest\whatever
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 			 */
402 402
 		');
403 403
 
404
-        $this->assertEquals('<?php
404
+		$this->assertEquals('<?php
405 405
 			/**
406 406
 			 * @!rest\if test red
407 407
 			 * @!rest\whatever
@@ -412,16 +412,16 @@  discard block
 block discarded – undo
412 412
 			 * @!rest\endif
413 413
 			 */
414 414
 		', $out);
415
-    }
415
+	}
416 416
 
417
-    /**
418
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
419
-     */
420
-    public function testPreprocess_Ifdef_AffectPrefixedOnly()
421
-    {
422
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
423
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
424
-        $out = $object->preprocess('<?php
417
+	/**
418
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
419
+	 */
420
+	public function testPreprocess_Ifdef_AffectPrefixedOnly()
421
+	{
422
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
423
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
424
+		$out = $object->preprocess('<?php
425 425
 			/**
426 426
 			 * @rest\ifdef test
427 427
 			 * @rest\whatever
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 			 */
433 433
 		');
434 434
 
435
-        $this->assertEquals('<?php
435
+		$this->assertEquals('<?php
436 436
 			/**
437 437
 			 * @!rest\ifdef test
438 438
 			 * @!rest\whatever
@@ -442,20 +442,20 @@  discard block
 block discarded – undo
442 442
 			 * @!rest\endif
443 443
 			 */
444 444
 		', $out);
445
-    }
446
-
447
-    /**
448
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
449
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::undefine
450
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
451
-     */
452
-    public function testPreprocess_Undefine()
453
-    {
454
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
455
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
456
-        $object->define('test');
457
-        $object->undefine('test');
458
-        $out = $object->preprocess('<?php
445
+	}
446
+
447
+	/**
448
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
449
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::undefine
450
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
451
+	 */
452
+	public function testPreprocess_Undefine()
453
+	{
454
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
455
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
456
+		$object->define('test');
457
+		$object->undefine('test');
458
+		$out = $object->preprocess('<?php
459 459
 			/**
460 460
 			 * @rest\ifdef test
461 461
 			 * @rest\whatever
@@ -463,27 +463,27 @@  discard block
 block discarded – undo
463 463
 			 */
464 464
 		');
465 465
 
466
-        $this->assertEquals('<?php
466
+		$this->assertEquals('<?php
467 467
 			/**
468 468
 			 * @!rest\ifdef test
469 469
 			 * @!rest\whatever
470 470
 			 * @!rest\endif
471 471
 			 */
472 472
 		', $out);
473
-    }
474
-
475
-    /**
476
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
477
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::resetDefines
478
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
479
-     */
480
-    public function testPreprocess_ResetDefines()
481
-    {
482
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
483
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
484
-        $object->define('test');
485
-        $object->resetDefines();
486
-        $out = $object->preprocess('<?php
473
+	}
474
+
475
+	/**
476
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
477
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::resetDefines
478
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
479
+	 */
480
+	public function testPreprocess_ResetDefines()
481
+	{
482
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
483
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
484
+		$object->define('test');
485
+		$object->resetDefines();
486
+		$out = $object->preprocess('<?php
487 487
 			/**
488 488
 			 * @rest\ifdef test
489 489
 			 * @rest\whatever
@@ -491,25 +491,25 @@  discard block
 block discarded – undo
491 491
 			 */
492 492
 		');
493 493
 
494
-        $this->assertEquals('<?php
494
+		$this->assertEquals('<?php
495 495
 			/**
496 496
 			 * @!rest\ifdef test
497 497
 			 * @!rest\whatever
498 498
 			 * @!rest\endif
499 499
 			 */
500 500
 		', $out);
501
-    }
502
-
503
-    /**
504
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::addDefines
505
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
506
-     */
507
-    public function testPreprocess_AddDefines()
508
-    {
509
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
510
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
511
-        $object->addDefines(array('test' => true));
512
-        $out = $object->preprocess('<?php
501
+	}
502
+
503
+	/**
504
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::addDefines
505
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
506
+	 */
507
+	public function testPreprocess_AddDefines()
508
+	{
509
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
510
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
511
+		$object->addDefines(array('test' => true));
512
+		$out = $object->preprocess('<?php
513 513
 			/**
514 514
 			 * @rest\ifdef test
515 515
 			 * @rest\whatever
@@ -517,23 +517,23 @@  discard block
 block discarded – undo
517 517
 			 */
518 518
 		');
519 519
 
520
-        $this->assertEquals('<?php
520
+		$this->assertEquals('<?php
521 521
 			/**
522 522
 			 * @!rest\ifdef test
523 523
 			 * @rest\whatever
524 524
 			 * @!rest\endif
525 525
 			 */
526 526
 		', $out);
527
-    }
527
+	}
528 528
 
529
-    /**
530
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
531
-     */
532
-    public function testPreprocess_AlternativePrefix()
533
-    {
534
-        $object = new \SwaggerGen\Parser\Php\Preprocessor('foo');
535
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
536
-        $out = $object->preprocess('<?php
529
+	/**
530
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
531
+	 */
532
+	public function testPreprocess_AlternativePrefix()
533
+	{
534
+		$object = new \SwaggerGen\Parser\Php\Preprocessor('foo');
535
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
536
+		$out = $object->preprocess('<?php
537 537
 			/**
538 538
 			 * @foo\ifdef test
539 539
 			 * @foo\whatever
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 			 */
543 543
 		');
544 544
 
545
-        $this->assertEquals('<?php
545
+		$this->assertEquals('<?php
546 546
 			/**
547 547
 			 * @!foo\ifdef test
548 548
 			 * @!foo\whatever
@@ -550,31 +550,31 @@  discard block
 block discarded – undo
550 550
 			 * @!foo\endif
551 551
 			 */
552 552
 		', $out);
553
-    }
553
+	}
554 554
 
555
-    /**
556
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
557
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocessFile
558
-     */
559
-    public function testPreprocessFile()
560
-    {
561
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
562
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
563
-        $object->define('test');
555
+	/**
556
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
557
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocessFile
558
+	 */
559
+	public function testPreprocessFile()
560
+	{
561
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
562
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
563
+		$object->define('test');
564 564
 
565
-        $out = $object->preprocessFile(__DIR__ . '/PreprocessorTest/testPreprocessFile.php');
565
+		$out = $object->preprocessFile(__DIR__ . '/PreprocessorTest/testPreprocessFile.php');
566 566
 
567
-        $this->assertEquals('<?php
567
+		$this->assertEquals('<?php
568 568
 
569 569
 /**
570 570
  * @!rest\ifdef test
571 571
  * @rest\whatever
572 572
  * @!rest\endif
573 573
  */', $out);
574
-    }
574
+	}
575 575
 
576
-    //@todo  preprocess($content) -> mingle with other PHP code
577
-    //@todo  preprocess($content) -> Condition within comment
578
-    //@todo  preprocess($content) -> Condition over comments
579
-    //@todo  preprocess($content) -> Condition over code
576
+	//@todo  preprocess($content) -> mingle with other PHP code
577
+	//@todo  preprocess($content) -> Condition within comment
578
+	//@todo  preprocess($content) -> Condition over comments
579
+	//@todo  preprocess($content) -> Condition over code
580 580
 }
Please login to merge, or discard this patch.
tests/Parser/Php/ParserTest.php 1 patch
Indentation   +510 added lines, -510 removed lines patch added patch discarded remove patch
@@ -8,515 +8,515 @@
 block discarded – undo
8 8
 class ParserTest extends TestCase
9 9
 {
10 10
 
11
-    /**
12
-     * @covers \SwaggerGen\Parser\Php\Parser::__construct
13
-     */
14
-    public function testConstructor_Empty()
15
-    {
16
-        $object = new Parser();
17
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
18
-    }
19
-
20
-    /**
21
-     * @covers \SwaggerGen\Parser\Php\Parser::__construct
22
-     */
23
-    public function testConstructor_Dirs()
24
-    {
25
-        $this->markTestIncomplete('Not yet implemented.');
26
-    }
27
-
28
-    /**
29
-     * @covers \SwaggerGen\Parser\Php\Parser::addDirs
30
-     */
31
-    public function testAddDirs()
32
-    {
33
-        $this->markTestIncomplete('Not yet implemented.');
34
-    }
35
-
36
-    /**
37
-     * Test all open-curlies are (ac-)counted for in functions
38
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
39
-     */
40
-    public function testParse_CurlyBraceFunction()
41
-    {
42
-        $object = new Parser();
43
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
44
-
45
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_CurlyBraceFunction.php');
46
-        $this->assertCount(6, $statements);
47
-        $this->assertStatement($statements[0], 'title', 'CurlyBraceFunction');
48
-    }
49
-
50
-    /**
51
-     * Test if the statement matches the expected values
52
-     * @param Statement $statement
53
-     * @param string $command
54
-     * @param string $data
55
-     */
56
-    private function assertStatement($statement, $command, $data = '')
57
-    {
58
-        $this->assertInstanceOf('\SwaggerGen\Statement', $statement);
59
-        $this->assertSame($command, $statement->getCommand());
60
-        $this->assertSame($data, $statement->getData());
61
-    }
62
-
63
-    /**
64
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
65
-     */
66
-    public function testParse_NoMethods()
67
-    {
68
-        $object = new Parser();
69
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
70
-
71
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_NoMethods.php');
72
-
73
-        $this->assertCount(2, $statements);
74
-
75
-        $this->assertStatement($statements[0], 'title', 'Some words');
76
-        $this->assertStatement($statements[1], 'version', '2');
77
-    }
78
-
79
-    /**
80
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
81
-     */
82
-    public function testParse_WithMethod()
83
-    {
84
-        $object = new Parser();
85
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
86
-
87
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_WithMethod.php');
88
-
89
-        $this->assertCount(4, $statements);
90
-
91
-        $this->assertStatement($statements[0], 'title', 'Some words');
92
-        $this->assertStatement($statements[1], 'version', '2');
93
-        $this->assertStatement($statements[2], 'description', 'some description');
94
-        $this->assertStatement($statements[3], 'method', 'get something');
95
-    }
96
-
97
-    /**
98
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
99
-     */
100
-    public function testParse_LineContinuation()
101
-    {
102
-        $object = new Parser();
103
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
104
-
105
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_LineContinuation.php');
106
-
107
-        $this->assertCount(2, $statements);
108
-
109
-        $this->assertStatement($statements[0], 'title', 'Some words');
110
-        $this->assertStatement($statements[1], 'description', 'About this strange little class');
111
-    }
112
-
113
-    /**
114
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
115
-     */
116
-    public function testParse_InClass()
117
-    {
118
-        $object = new Parser();
119
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
120
-
121
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_InClass.php');
122
-
123
-        $this->assertCount(3, $statements);
124
-
125
-        $this->assertStatement($statements[0], 'title', 'Some words');
126
-        $this->assertStatement($statements[1], 'description', 'Some description');
127
-        $this->assertStatement($statements[2], 'license', 'mit');
128
-    }
129
-
130
-    /**
131
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
132
-     */
133
-    public function testParse_CommentsTypes()
134
-    {
135
-        $object = new Parser();
136
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
137
-
138
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_CommentsTypes.php');
139
-
140
-        $this->assertCount(3, $statements);
141
-
142
-        $this->assertStatement($statements[0], 'title', 'Some words');
143
-        $this->assertStatement($statements[1], 'version', '2');
144
-        $this->assertStatement($statements[2], 'license', 'mit');
145
-    }
146
-
147
-    /**
148
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
149
-     */
150
-    public function testParse_MethodNonDoc()
151
-    {
152
-        $object = new Parser();
153
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
154
-
155
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_MethodNonDoc.php');
156
-
157
-        $this->assertCount(3, $statements);
158
-
159
-        $this->assertStatement($statements[0], 'title', 'Some words');
160
-        $this->assertStatement($statements[1], 'version', '2');
161
-        $this->assertStatement($statements[2], 'method', 'get something');
162
-    }
163
-
164
-    /**
165
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
166
-     */
167
-    public function testParse_InMethod()
168
-    {
169
-        $object = new Parser();
170
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
171
-
172
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_InMethod.php');
173
-
174
-        $this->assertCount(4, $statements);
175
-
176
-        $this->assertStatement($statements[0], 'title', 'Some words');
177
-        $this->assertStatement($statements[1], 'version', '2');
178
-        $this->assertStatement($statements[2], 'description', 'some description');
179
-        $this->assertStatement($statements[3], 'method', 'get something');
180
-    }
181
-
182
-    /**
183
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
184
-     */
185
-    public function testParse_AfterClass()
186
-    {
187
-        $object = new Parser();
188
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
189
-
190
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_AfterClass.php');
191
-
192
-        $this->assertCount(2, $statements);
193
-
194
-        $this->assertStatement($statements[0], 'license', 'mit');
195
-        $this->assertStatement($statements[1], 'title', 'Some words');
196
-    }
197
-
198
-    /**
199
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
200
-     */
201
-    public function testParse_Prefix()
202
-    {
203
-        $object = new Parser();
204
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
205
-
206
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_Prefix.php');
207
-
208
-        $this->assertCount(1, $statements);
209
-
210
-        $this->assertStatement($statements[0], 'title', 'Some words');
211
-    }
212
-
213
-    /**
214
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
215
-     */
216
-    public function testParse_PropertyReadOnly()
217
-    {
218
-        $object = new Parser();
219
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
220
-
221
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_PropertyReadOnly.php');
222
-
223
-        $this->assertCount(4, $statements);
224
-
225
-        $this->assertStatement($statements[0], 'title', 'Some words');
226
-        $this->assertStatement($statements[1], 'version', '2');
227
-        $this->assertStatement($statements[2], 'definition', 'Foo');
228
-        $this->assertStatement($statements[3], 'property!', 'string bar');
229
-    }
230
-
231
-    /**
232
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
233
-     */
234
-    public function testParse_PropertyOptional()
235
-    {
236
-        $object = new Parser();
237
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
238
-
239
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_PropertyOptional.php');
240
-
241
-        $this->assertCount(4, $statements);
242
-
243
-        $this->assertStatement($statements[0], 'title', 'Some words');
244
-        $this->assertStatement($statements[1], 'version', '2');
245
-        $this->assertStatement($statements[2], 'definition', 'Foo');
246
-        $this->assertStatement($statements[3], 'property?', 'string bar');
247
-    }
248
-
249
-    /**
250
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
251
-     */
252
-    public function testParse_Minimal()
253
-    {
254
-        $object = new Parser();
255
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
256
-
257
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_Minimal.php');
258
-
259
-        $this->assertCount(4, $statements);
260
-
261
-        $this->assertStatement($statements[0], 'title', 'Minimal');
262
-        $this->assertStatement($statements[1], 'api', 'MyApi Example');
263
-        $this->assertStatement($statements[2], 'endpoint', '/endpoint');
264
-        $this->assertStatement($statements[3], 'method', 'GET Something');
265
-    }
266
-
267
-    /**
268
-     * Tests FunctionName
269
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
270
-     */
271
-    public function testParse_SeeFunction()
272
-    {
273
-        $object = new Parser();
274
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
275
-
276
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeFunction.php');
277
-
278
-        $this->assertStatements(array(
279
-            array('api', 'MyApi Example'),
280
-            array('endpoint', '/endpoint'),
281
-            array('method', 'GET Something'),
282
-            array('error', '400'),
283
-        ), $statements);
284
-    }
285
-
286
-    /**
287
-     * Test if the statement matches the expected values
288
-     * @param array[] $expected
289
-     * @param SwaggerGen\Parser\Php\Statement[] $statements
290
-     */
291
-    private function assertStatements(array $expected, array $statements)
292
-    {
293
-        $this->assertCount(count($expected), $statements, join("\n", $statements));
294
-        foreach ($expected as $index => $command) {
295
-            $statement = $statements[$index];
296
-            $this->assertInstanceOf('\SwaggerGen\Statement', $statement);
297
-            $this->assertSame($command[0], $statement->getCommand());
298
-            $this->assertSame($command[1], $statement->getData());
299
-        }
300
-    }
301
-
302
-    /**
303
-     * Tests $this->MethodName
304
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
305
-     */
306
-    public function testParse_SeeThisMethod()
307
-    {
308
-        $object = new Parser();
309
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
310
-
311
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeThisMethod.php');
312
-
313
-        $this->assertStatements(array(
314
-            array('api', 'MyApi Example'),
315
-            array('endpoint', '/endpoint'),
316
-            array('method', 'GET Something'),
317
-            array('error', '400'),
318
-        ), $statements);
319
-    }
320
-
321
-    /**
322
-     * Tests Class->MethodName
323
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
324
-     */
325
-    public function testParse_SeeObjectMethod()
326
-    {
327
-        $object = new Parser();
328
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
329
-
330
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeObjectMethod.php');
331
-
332
-        $this->assertStatements(array(
333
-            array('api', 'MyApi Example'),
334
-            array('endpoint', '/endpoint'),
335
-            array('method', 'GET Something'),
336
-            array('error', '400'),
337
-        ), $statements);
338
-    }
339
-
340
-    /**
341
-     * Tests self::MethodName
342
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
343
-     */
344
-    public function testParse_SeeSelfMethod()
345
-    {
346
-        $object = new Parser();
347
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
348
-
349
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeSelfMethod.php');
350
-
351
-        $this->assertStatements(array(
352
-            array('api', 'MyApi Example'),
353
-            array('endpoint', '/endpoint'),
354
-            array('method', 'GET Something'),
355
-            array('error', '400'),
356
-        ), $statements);
357
-    }
358
-
359
-    /**
360
-     * Tests Class::MethodName
361
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
362
-     */
363
-    public function testParse_SeeClassMethod()
364
-    {
365
-        $object = new Parser();
366
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
367
-
368
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeClassMethod.php');
369
-
370
-        $this->assertStatements(array(
371
-            array('api', 'MyApi Example'),
372
-            array('endpoint', '/endpoint'),
373
-            array('method', 'GET Something'),
374
-            array('error', '400'),
375
-        ), $statements);
376
-    }
377
-
378
-    /**
379
-     * Tests static::MethodName
380
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
381
-     */
382
-    public function testParse_StaticMethod()
383
-    {
384
-        $object = new Parser();
385
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
386
-
387
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_StaticMethod.php');
388
-
389
-        $this->assertStatements(array(
390
-            array('api', 'MyApi Example'),
391
-            array('endpoint', '/endpoint'),
392
-            array('method', 'GET Something'),
393
-            array('error', '400'),
394
-        ), $statements);
395
-    }
396
-
397
-    /**
398
-     * Tests $this->MethodName with inheritance
399
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
400
-     */
401
-    public function testParse_SeeInheritedThisMethod()
402
-    {
403
-        $object = new Parser();
404
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
405
-
406
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeInheritedThisMethod.php');
407
-
408
-        $this->assertStatements(array(
409
-            array('api', 'MyApi Example'),
410
-            array('endpoint', '/endpoint'),
411
-            array('method', 'GET Something'),
412
-            array('error', '400'),
413
-        ), $statements);
414
-    }
415
-
416
-    /**
417
-     * Tests Class->MethodName with inheritance
418
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
419
-     */
420
-    public function testParse_SeeInheritedObjectMethod()
421
-    {
422
-        $object = new Parser();
423
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
424
-
425
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeInheritedObjectMethod.php');
426
-
427
-        $this->assertStatements(array(
428
-            array('api', 'MyApi Example'),
429
-            array('endpoint', '/endpoint'),
430
-            array('method', 'GET Something'),
431
-            array('error', '400'),
432
-        ), $statements);
433
-    }
434
-
435
-    /**
436
-     * Tests Autoloading other class when referenced
437
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
438
-     */
439
-    public function testParse_Autoload_Parse()
440
-    {
441
-        $object = new Parser();
442
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
443
-
444
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php', array(
445
-            __DIR__ . '/ParserTest',
446
-        ));
447
-
448
-        $this->assertStatements(array(
449
-            array('api', 'MyApi Example'),
450
-            array('endpoint', '/endpoint'),
451
-            array('method', 'GET Something'),
452
-            array('error', '400'),
453
-        ), $statements);
454
-    }
455
-
456
-    /**
457
-     * Tests Autoloading other class when referenced
458
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
459
-     */
460
-    public function testParse_Autoload_Construct()
461
-    {
462
-        $object = new Parser(array(
463
-            __DIR__ . '/ParserTest',
464
-        ));
465
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
466
-
467
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php');
468
-
469
-        $this->assertStatements(array(
470
-            array('api', 'MyApi Example'),
471
-            array('endpoint', '/endpoint'),
472
-            array('method', 'GET Something'),
473
-            array('error', '400'),
474
-        ), $statements);
475
-    }
476
-
477
-    /**
478
-     * Tests Autoloading other class when referenced
479
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
480
-     */
481
-    public function testParse_Autoload_AddDirs()
482
-    {
483
-        $object = new Parser();
484
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
485
-
486
-        $object->addDirs(array(
487
-            __DIR__ . '/ParserTest',
488
-        ));
489
-
490
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php');
491
-
492
-        $this->assertStatements(array(
493
-            array('api', 'MyApi Example'),
494
-            array('endpoint', '/endpoint'),
495
-            array('method', 'GET Something'),
496
-            array('error', '400'),
497
-        ), $statements);
498
-    }
499
-
500
-    /**
501
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
502
-     */
503
-    public function testParse_XTag()
504
-    {
505
-        $object = new Parser();
506
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
507
-
508
-        $object->addDirs(array(
509
-            __DIR__ . '/ParserTest',
510
-        ));
511
-
512
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_XTag.php');
513
-
514
-        $this->assertStatements(array(
515
-            array('api', 'MyApi Example'),
516
-            array('endpoint', '/endpoint'),
517
-            array('x-something', 'else'),
518
-            array('method', 'GET Something'),
519
-        ), $statements);
520
-    }
11
+	/**
12
+	 * @covers \SwaggerGen\Parser\Php\Parser::__construct
13
+	 */
14
+	public function testConstructor_Empty()
15
+	{
16
+		$object = new Parser();
17
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
18
+	}
19
+
20
+	/**
21
+	 * @covers \SwaggerGen\Parser\Php\Parser::__construct
22
+	 */
23
+	public function testConstructor_Dirs()
24
+	{
25
+		$this->markTestIncomplete('Not yet implemented.');
26
+	}
27
+
28
+	/**
29
+	 * @covers \SwaggerGen\Parser\Php\Parser::addDirs
30
+	 */
31
+	public function testAddDirs()
32
+	{
33
+		$this->markTestIncomplete('Not yet implemented.');
34
+	}
35
+
36
+	/**
37
+	 * Test all open-curlies are (ac-)counted for in functions
38
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
39
+	 */
40
+	public function testParse_CurlyBraceFunction()
41
+	{
42
+		$object = new Parser();
43
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
44
+
45
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_CurlyBraceFunction.php');
46
+		$this->assertCount(6, $statements);
47
+		$this->assertStatement($statements[0], 'title', 'CurlyBraceFunction');
48
+	}
49
+
50
+	/**
51
+	 * Test if the statement matches the expected values
52
+	 * @param Statement $statement
53
+	 * @param string $command
54
+	 * @param string $data
55
+	 */
56
+	private function assertStatement($statement, $command, $data = '')
57
+	{
58
+		$this->assertInstanceOf('\SwaggerGen\Statement', $statement);
59
+		$this->assertSame($command, $statement->getCommand());
60
+		$this->assertSame($data, $statement->getData());
61
+	}
62
+
63
+	/**
64
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
65
+	 */
66
+	public function testParse_NoMethods()
67
+	{
68
+		$object = new Parser();
69
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
70
+
71
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_NoMethods.php');
72
+
73
+		$this->assertCount(2, $statements);
74
+
75
+		$this->assertStatement($statements[0], 'title', 'Some words');
76
+		$this->assertStatement($statements[1], 'version', '2');
77
+	}
78
+
79
+	/**
80
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
81
+	 */
82
+	public function testParse_WithMethod()
83
+	{
84
+		$object = new Parser();
85
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
86
+
87
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_WithMethod.php');
88
+
89
+		$this->assertCount(4, $statements);
90
+
91
+		$this->assertStatement($statements[0], 'title', 'Some words');
92
+		$this->assertStatement($statements[1], 'version', '2');
93
+		$this->assertStatement($statements[2], 'description', 'some description');
94
+		$this->assertStatement($statements[3], 'method', 'get something');
95
+	}
96
+
97
+	/**
98
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
99
+	 */
100
+	public function testParse_LineContinuation()
101
+	{
102
+		$object = new Parser();
103
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
104
+
105
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_LineContinuation.php');
106
+
107
+		$this->assertCount(2, $statements);
108
+
109
+		$this->assertStatement($statements[0], 'title', 'Some words');
110
+		$this->assertStatement($statements[1], 'description', 'About this strange little class');
111
+	}
112
+
113
+	/**
114
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
115
+	 */
116
+	public function testParse_InClass()
117
+	{
118
+		$object = new Parser();
119
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
120
+
121
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_InClass.php');
122
+
123
+		$this->assertCount(3, $statements);
124
+
125
+		$this->assertStatement($statements[0], 'title', 'Some words');
126
+		$this->assertStatement($statements[1], 'description', 'Some description');
127
+		$this->assertStatement($statements[2], 'license', 'mit');
128
+	}
129
+
130
+	/**
131
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
132
+	 */
133
+	public function testParse_CommentsTypes()
134
+	{
135
+		$object = new Parser();
136
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
137
+
138
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_CommentsTypes.php');
139
+
140
+		$this->assertCount(3, $statements);
141
+
142
+		$this->assertStatement($statements[0], 'title', 'Some words');
143
+		$this->assertStatement($statements[1], 'version', '2');
144
+		$this->assertStatement($statements[2], 'license', 'mit');
145
+	}
146
+
147
+	/**
148
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
149
+	 */
150
+	public function testParse_MethodNonDoc()
151
+	{
152
+		$object = new Parser();
153
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
154
+
155
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_MethodNonDoc.php');
156
+
157
+		$this->assertCount(3, $statements);
158
+
159
+		$this->assertStatement($statements[0], 'title', 'Some words');
160
+		$this->assertStatement($statements[1], 'version', '2');
161
+		$this->assertStatement($statements[2], 'method', 'get something');
162
+	}
163
+
164
+	/**
165
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
166
+	 */
167
+	public function testParse_InMethod()
168
+	{
169
+		$object = new Parser();
170
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
171
+
172
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_InMethod.php');
173
+
174
+		$this->assertCount(4, $statements);
175
+
176
+		$this->assertStatement($statements[0], 'title', 'Some words');
177
+		$this->assertStatement($statements[1], 'version', '2');
178
+		$this->assertStatement($statements[2], 'description', 'some description');
179
+		$this->assertStatement($statements[3], 'method', 'get something');
180
+	}
181
+
182
+	/**
183
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
184
+	 */
185
+	public function testParse_AfterClass()
186
+	{
187
+		$object = new Parser();
188
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
189
+
190
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_AfterClass.php');
191
+
192
+		$this->assertCount(2, $statements);
193
+
194
+		$this->assertStatement($statements[0], 'license', 'mit');
195
+		$this->assertStatement($statements[1], 'title', 'Some words');
196
+	}
197
+
198
+	/**
199
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
200
+	 */
201
+	public function testParse_Prefix()
202
+	{
203
+		$object = new Parser();
204
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
205
+
206
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_Prefix.php');
207
+
208
+		$this->assertCount(1, $statements);
209
+
210
+		$this->assertStatement($statements[0], 'title', 'Some words');
211
+	}
212
+
213
+	/**
214
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
215
+	 */
216
+	public function testParse_PropertyReadOnly()
217
+	{
218
+		$object = new Parser();
219
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
220
+
221
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_PropertyReadOnly.php');
222
+
223
+		$this->assertCount(4, $statements);
224
+
225
+		$this->assertStatement($statements[0], 'title', 'Some words');
226
+		$this->assertStatement($statements[1], 'version', '2');
227
+		$this->assertStatement($statements[2], 'definition', 'Foo');
228
+		$this->assertStatement($statements[3], 'property!', 'string bar');
229
+	}
230
+
231
+	/**
232
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
233
+	 */
234
+	public function testParse_PropertyOptional()
235
+	{
236
+		$object = new Parser();
237
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
238
+
239
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_PropertyOptional.php');
240
+
241
+		$this->assertCount(4, $statements);
242
+
243
+		$this->assertStatement($statements[0], 'title', 'Some words');
244
+		$this->assertStatement($statements[1], 'version', '2');
245
+		$this->assertStatement($statements[2], 'definition', 'Foo');
246
+		$this->assertStatement($statements[3], 'property?', 'string bar');
247
+	}
248
+
249
+	/**
250
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
251
+	 */
252
+	public function testParse_Minimal()
253
+	{
254
+		$object = new Parser();
255
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
256
+
257
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_Minimal.php');
258
+
259
+		$this->assertCount(4, $statements);
260
+
261
+		$this->assertStatement($statements[0], 'title', 'Minimal');
262
+		$this->assertStatement($statements[1], 'api', 'MyApi Example');
263
+		$this->assertStatement($statements[2], 'endpoint', '/endpoint');
264
+		$this->assertStatement($statements[3], 'method', 'GET Something');
265
+	}
266
+
267
+	/**
268
+	 * Tests FunctionName
269
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
270
+	 */
271
+	public function testParse_SeeFunction()
272
+	{
273
+		$object = new Parser();
274
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
275
+
276
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeFunction.php');
277
+
278
+		$this->assertStatements(array(
279
+			array('api', 'MyApi Example'),
280
+			array('endpoint', '/endpoint'),
281
+			array('method', 'GET Something'),
282
+			array('error', '400'),
283
+		), $statements);
284
+	}
285
+
286
+	/**
287
+	 * Test if the statement matches the expected values
288
+	 * @param array[] $expected
289
+	 * @param SwaggerGen\Parser\Php\Statement[] $statements
290
+	 */
291
+	private function assertStatements(array $expected, array $statements)
292
+	{
293
+		$this->assertCount(count($expected), $statements, join("\n", $statements));
294
+		foreach ($expected as $index => $command) {
295
+			$statement = $statements[$index];
296
+			$this->assertInstanceOf('\SwaggerGen\Statement', $statement);
297
+			$this->assertSame($command[0], $statement->getCommand());
298
+			$this->assertSame($command[1], $statement->getData());
299
+		}
300
+	}
301
+
302
+	/**
303
+	 * Tests $this->MethodName
304
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
305
+	 */
306
+	public function testParse_SeeThisMethod()
307
+	{
308
+		$object = new Parser();
309
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
310
+
311
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeThisMethod.php');
312
+
313
+		$this->assertStatements(array(
314
+			array('api', 'MyApi Example'),
315
+			array('endpoint', '/endpoint'),
316
+			array('method', 'GET Something'),
317
+			array('error', '400'),
318
+		), $statements);
319
+	}
320
+
321
+	/**
322
+	 * Tests Class->MethodName
323
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
324
+	 */
325
+	public function testParse_SeeObjectMethod()
326
+	{
327
+		$object = new Parser();
328
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
329
+
330
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeObjectMethod.php');
331
+
332
+		$this->assertStatements(array(
333
+			array('api', 'MyApi Example'),
334
+			array('endpoint', '/endpoint'),
335
+			array('method', 'GET Something'),
336
+			array('error', '400'),
337
+		), $statements);
338
+	}
339
+
340
+	/**
341
+	 * Tests self::MethodName
342
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
343
+	 */
344
+	public function testParse_SeeSelfMethod()
345
+	{
346
+		$object = new Parser();
347
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
348
+
349
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeSelfMethod.php');
350
+
351
+		$this->assertStatements(array(
352
+			array('api', 'MyApi Example'),
353
+			array('endpoint', '/endpoint'),
354
+			array('method', 'GET Something'),
355
+			array('error', '400'),
356
+		), $statements);
357
+	}
358
+
359
+	/**
360
+	 * Tests Class::MethodName
361
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
362
+	 */
363
+	public function testParse_SeeClassMethod()
364
+	{
365
+		$object = new Parser();
366
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
367
+
368
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeClassMethod.php');
369
+
370
+		$this->assertStatements(array(
371
+			array('api', 'MyApi Example'),
372
+			array('endpoint', '/endpoint'),
373
+			array('method', 'GET Something'),
374
+			array('error', '400'),
375
+		), $statements);
376
+	}
377
+
378
+	/**
379
+	 * Tests static::MethodName
380
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
381
+	 */
382
+	public function testParse_StaticMethod()
383
+	{
384
+		$object = new Parser();
385
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
386
+
387
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_StaticMethod.php');
388
+
389
+		$this->assertStatements(array(
390
+			array('api', 'MyApi Example'),
391
+			array('endpoint', '/endpoint'),
392
+			array('method', 'GET Something'),
393
+			array('error', '400'),
394
+		), $statements);
395
+	}
396
+
397
+	/**
398
+	 * Tests $this->MethodName with inheritance
399
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
400
+	 */
401
+	public function testParse_SeeInheritedThisMethod()
402
+	{
403
+		$object = new Parser();
404
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
405
+
406
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeInheritedThisMethod.php');
407
+
408
+		$this->assertStatements(array(
409
+			array('api', 'MyApi Example'),
410
+			array('endpoint', '/endpoint'),
411
+			array('method', 'GET Something'),
412
+			array('error', '400'),
413
+		), $statements);
414
+	}
415
+
416
+	/**
417
+	 * Tests Class->MethodName with inheritance
418
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
419
+	 */
420
+	public function testParse_SeeInheritedObjectMethod()
421
+	{
422
+		$object = new Parser();
423
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
424
+
425
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeInheritedObjectMethod.php');
426
+
427
+		$this->assertStatements(array(
428
+			array('api', 'MyApi Example'),
429
+			array('endpoint', '/endpoint'),
430
+			array('method', 'GET Something'),
431
+			array('error', '400'),
432
+		), $statements);
433
+	}
434
+
435
+	/**
436
+	 * Tests Autoloading other class when referenced
437
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
438
+	 */
439
+	public function testParse_Autoload_Parse()
440
+	{
441
+		$object = new Parser();
442
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
443
+
444
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php', array(
445
+			__DIR__ . '/ParserTest',
446
+		));
447
+
448
+		$this->assertStatements(array(
449
+			array('api', 'MyApi Example'),
450
+			array('endpoint', '/endpoint'),
451
+			array('method', 'GET Something'),
452
+			array('error', '400'),
453
+		), $statements);
454
+	}
455
+
456
+	/**
457
+	 * Tests Autoloading other class when referenced
458
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
459
+	 */
460
+	public function testParse_Autoload_Construct()
461
+	{
462
+		$object = new Parser(array(
463
+			__DIR__ . '/ParserTest',
464
+		));
465
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
466
+
467
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php');
468
+
469
+		$this->assertStatements(array(
470
+			array('api', 'MyApi Example'),
471
+			array('endpoint', '/endpoint'),
472
+			array('method', 'GET Something'),
473
+			array('error', '400'),
474
+		), $statements);
475
+	}
476
+
477
+	/**
478
+	 * Tests Autoloading other class when referenced
479
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
480
+	 */
481
+	public function testParse_Autoload_AddDirs()
482
+	{
483
+		$object = new Parser();
484
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
485
+
486
+		$object->addDirs(array(
487
+			__DIR__ . '/ParserTest',
488
+		));
489
+
490
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php');
491
+
492
+		$this->assertStatements(array(
493
+			array('api', 'MyApi Example'),
494
+			array('endpoint', '/endpoint'),
495
+			array('method', 'GET Something'),
496
+			array('error', '400'),
497
+		), $statements);
498
+	}
499
+
500
+	/**
501
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
502
+	 */
503
+	public function testParse_XTag()
504
+	{
505
+		$object = new Parser();
506
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
507
+
508
+		$object->addDirs(array(
509
+			__DIR__ . '/ParserTest',
510
+		));
511
+
512
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_XTag.php');
513
+
514
+		$this->assertStatements(array(
515
+			array('api', 'MyApi Example'),
516
+			array('endpoint', '/endpoint'),
517
+			array('x-something', 'else'),
518
+			array('method', 'GET Something'),
519
+		), $statements);
520
+	}
521 521
 
522 522
 }
Please login to merge, or discard this patch.
tests/Swagger/SchemaTest.php 1 patch
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -6,138 +6,138 @@
 block discarded – undo
6 6
 class SchemaTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Schema::__construct
13
-     */
14
-    public function testConstructorEmpty()
15
-    {
16
-        $object = new \SwaggerGen\Swagger\Schema($this->parent);
17
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
18
-
19
-        $this->assertSame(array(
20
-            'type' => 'object',
21
-        ), $object->toArray());
22
-    }
23
-
24
-    /**
25
-     * @covers \SwaggerGen\Swagger\Schema::__construct
26
-     */
27
-    public function testConstructorType()
28
-    {
29
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
30
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
31
-
32
-        $this->assertSame(array(
33
-            'type' => 'integer',
34
-            'format' => 'int32',
35
-        ), $object->toArray());
36
-    }
37
-
38
-    /**
39
-     * @covers \SwaggerGen\Swagger\Schema::__construct
40
-     */
41
-    public function testConstructorReference()
42
-    {
43
-        $this->parent->handleCommand('model', 'User');
44
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'User');
45
-
46
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
47
-
48
-        $this->assertSame(array(
49
-            '$ref' => '#/definitions/User',
50
-        ), $object->toArray());
51
-    }
52
-
53
-    /**
54
-     * @covers \SwaggerGen\Swagger\Schema::__construct
55
-     */
56
-    public function testConstructorEmptyDescription()
57
-    {
58
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int', '');
59
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
60
-
61
-        $this->assertSame(array(
62
-            'type' => 'integer',
63
-            'format' => 'int32',
64
-        ), $object->toArray());
65
-    }
66
-
67
-    /**
68
-     * @covers \SwaggerGen\Swagger\Schema::__construct
69
-     */
70
-    public function testConstructorDescription()
71
-    {
72
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int', 'Some more words');
73
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
74
-
75
-        $this->assertSame(array(
76
-            'type' => 'integer',
77
-            'format' => 'int32',
78
-            'description' => 'Some more words',
79
-        ), $object->toArray());
80
-    }
81
-
82
-    /**
83
-     * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
84
-     */
85
-    public function testCommandPassing()
86
-    {
87
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
88
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
89
-
90
-        $object->handleCommand('default', '123');
91
-
92
-        $this->assertSame(array(
93
-            'type' => 'integer',
94
-            'format' => 'int32',
95
-            'default' => 123,
96
-        ), $object->toArray());
97
-    }
98
-
99
-    /**
100
-     * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
101
-     */
102
-    public function testCommand_Description()
103
-    {
104
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
105
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
106
-
107
-        $object->handleCommand('description', 'Some words');
108
-
109
-        $this->assertSame(array(
110
-            'type' => 'integer',
111
-            'format' => 'int32',
112
-            'description' => 'Some words',
113
-        ), $object->toArray());
114
-    }
115
-
116
-    /**
117
-     * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
118
-     */
119
-    public function testCommand_Title()
120
-    {
121
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
122
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
123
-
124
-        $object->handleCommand('title', 'Title words');
125
-
126
-        $this->assertSame(array(
127
-            'type' => 'integer',
128
-            'format' => 'int32',
129
-            'title' => 'Title words',
130
-        ), $object->toArray());
131
-    }
132
-
133
-    protected function setUp(): void
134
-    {
135
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
136
-    }
137
-
138
-    protected function assertPreConditions(): void
139
-    {
140
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
141
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Schema::__construct
13
+	 */
14
+	public function testConstructorEmpty()
15
+	{
16
+		$object = new \SwaggerGen\Swagger\Schema($this->parent);
17
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
18
+
19
+		$this->assertSame(array(
20
+			'type' => 'object',
21
+		), $object->toArray());
22
+	}
23
+
24
+	/**
25
+	 * @covers \SwaggerGen\Swagger\Schema::__construct
26
+	 */
27
+	public function testConstructorType()
28
+	{
29
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
30
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
31
+
32
+		$this->assertSame(array(
33
+			'type' => 'integer',
34
+			'format' => 'int32',
35
+		), $object->toArray());
36
+	}
37
+
38
+	/**
39
+	 * @covers \SwaggerGen\Swagger\Schema::__construct
40
+	 */
41
+	public function testConstructorReference()
42
+	{
43
+		$this->parent->handleCommand('model', 'User');
44
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'User');
45
+
46
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
47
+
48
+		$this->assertSame(array(
49
+			'$ref' => '#/definitions/User',
50
+		), $object->toArray());
51
+	}
52
+
53
+	/**
54
+	 * @covers \SwaggerGen\Swagger\Schema::__construct
55
+	 */
56
+	public function testConstructorEmptyDescription()
57
+	{
58
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int', '');
59
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
60
+
61
+		$this->assertSame(array(
62
+			'type' => 'integer',
63
+			'format' => 'int32',
64
+		), $object->toArray());
65
+	}
66
+
67
+	/**
68
+	 * @covers \SwaggerGen\Swagger\Schema::__construct
69
+	 */
70
+	public function testConstructorDescription()
71
+	{
72
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int', 'Some more words');
73
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
74
+
75
+		$this->assertSame(array(
76
+			'type' => 'integer',
77
+			'format' => 'int32',
78
+			'description' => 'Some more words',
79
+		), $object->toArray());
80
+	}
81
+
82
+	/**
83
+	 * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
84
+	 */
85
+	public function testCommandPassing()
86
+	{
87
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
88
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
89
+
90
+		$object->handleCommand('default', '123');
91
+
92
+		$this->assertSame(array(
93
+			'type' => 'integer',
94
+			'format' => 'int32',
95
+			'default' => 123,
96
+		), $object->toArray());
97
+	}
98
+
99
+	/**
100
+	 * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
101
+	 */
102
+	public function testCommand_Description()
103
+	{
104
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
105
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
106
+
107
+		$object->handleCommand('description', 'Some words');
108
+
109
+		$this->assertSame(array(
110
+			'type' => 'integer',
111
+			'format' => 'int32',
112
+			'description' => 'Some words',
113
+		), $object->toArray());
114
+	}
115
+
116
+	/**
117
+	 * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
118
+	 */
119
+	public function testCommand_Title()
120
+	{
121
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
122
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
123
+
124
+		$object->handleCommand('title', 'Title words');
125
+
126
+		$this->assertSame(array(
127
+			'type' => 'integer',
128
+			'format' => 'int32',
129
+			'title' => 'Title words',
130
+		), $object->toArray());
131
+	}
132
+
133
+	protected function setUp(): void
134
+	{
135
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
136
+	}
137
+
138
+	protected function assertPreConditions(): void
139
+	{
140
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
141
+	}
142 142
 
143 143
 }
Please login to merge, or discard this patch.
tests/Swagger/HeaderTest.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -7,99 +7,99 @@
 block discarded – undo
7 7
 class HeaderTest extends TestCase
8 8
 {
9 9
 
10
-    protected $parent;
11
-
12
-    /**
13
-     * @covers \SwaggerGen\Swagger\Header::__construct
14
-     */
15
-    public function testConstructorType(): void
16
-    {
17
-        $object = new \SwaggerGen\Swagger\Header($this->parent, 'integer');
18
-
19
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
20
-
21
-        $this->assertSame(array(
22
-            'type' => 'integer',
23
-        ), $object->toArray());
24
-    }
25
-
26
-    /**
27
-     * @covers \SwaggerGen\Swagger\Header::__construct
28
-     */
29
-    public function testConstructorInvalidType()
30
-    {
31
-        $this->expectException('\SwaggerGen\Exception', "Header type not valid: 'BadType'");
32
-
33
-        new \SwaggerGen\Swagger\Header($this->parent, 'BadType');
34
-    }
35
-
36
-    /**
37
-     * @covers \SwaggerGen\Swagger\Header::__construct
38
-     */
39
-    public function testConstructorNoDescription()
40
-    {
41
-        $object = new \SwaggerGen\Swagger\Header($this->parent, 'integer');
42
-
43
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
44
-
45
-        $this->assertSame(array(
46
-            'type' => 'integer',
47
-        ), $object->toArray());
48
-    }
49
-
50
-    /**
51
-     * @covers \SwaggerGen\Swagger\Header::__construct
52
-     */
53
-    public function testConstructorBlankDescription()
54
-    {
55
-        $object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', '');
56
-
57
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
58
-
59
-        $this->assertSame(array(
60
-            'type' => 'integer',
61
-        ), $object->toArray());
62
-    }
63
-
64
-    /**
65
-     * @covers \SwaggerGen\Swagger\Header::__construct
66
-     */
67
-    public function testConstructorFull()
68
-    {
69
-        $object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', 'descriptive text');
70
-
71
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
72
-
73
-        $this->assertSame(array(
74
-            'type' => 'integer',
75
-            'description' => 'descriptive text',
76
-        ), $object->toArray());
77
-    }
78
-
79
-    /**
80
-     * @covers \SwaggerGen\Swagger\Header->handleCommand
81
-     */
82
-    public function testCommandDescription()
83
-    {
84
-        $object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', 'descriptive text');
85
-
86
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
87
-
88
-        $object->handleCommand('description', 'Some other lines');
89
-
90
-        $this->assertSame(array(
91
-            'type' => 'integer',
92
-            'description' => 'Some other lines',
93
-        ), $object->toArray());
94
-    }
95
-
96
-    protected function setUp(): void
97
-    {
98
-        $this->parent = $this->getMockForAbstractClass(AbstractObject::class);
99
-    }
100
-
101
-    protected function assertPreConditions(): void
102
-    {
103
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
104
-    }
10
+	protected $parent;
11
+
12
+	/**
13
+	 * @covers \SwaggerGen\Swagger\Header::__construct
14
+	 */
15
+	public function testConstructorType(): void
16
+	{
17
+		$object = new \SwaggerGen\Swagger\Header($this->parent, 'integer');
18
+
19
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
20
+
21
+		$this->assertSame(array(
22
+			'type' => 'integer',
23
+		), $object->toArray());
24
+	}
25
+
26
+	/**
27
+	 * @covers \SwaggerGen\Swagger\Header::__construct
28
+	 */
29
+	public function testConstructorInvalidType()
30
+	{
31
+		$this->expectException('\SwaggerGen\Exception', "Header type not valid: 'BadType'");
32
+
33
+		new \SwaggerGen\Swagger\Header($this->parent, 'BadType');
34
+	}
35
+
36
+	/**
37
+	 * @covers \SwaggerGen\Swagger\Header::__construct
38
+	 */
39
+	public function testConstructorNoDescription()
40
+	{
41
+		$object = new \SwaggerGen\Swagger\Header($this->parent, 'integer');
42
+
43
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
44
+
45
+		$this->assertSame(array(
46
+			'type' => 'integer',
47
+		), $object->toArray());
48
+	}
49
+
50
+	/**
51
+	 * @covers \SwaggerGen\Swagger\Header::__construct
52
+	 */
53
+	public function testConstructorBlankDescription()
54
+	{
55
+		$object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', '');
56
+
57
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
58
+
59
+		$this->assertSame(array(
60
+			'type' => 'integer',
61
+		), $object->toArray());
62
+	}
63
+
64
+	/**
65
+	 * @covers \SwaggerGen\Swagger\Header::__construct
66
+	 */
67
+	public function testConstructorFull()
68
+	{
69
+		$object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', 'descriptive text');
70
+
71
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
72
+
73
+		$this->assertSame(array(
74
+			'type' => 'integer',
75
+			'description' => 'descriptive text',
76
+		), $object->toArray());
77
+	}
78
+
79
+	/**
80
+	 * @covers \SwaggerGen\Swagger\Header->handleCommand
81
+	 */
82
+	public function testCommandDescription()
83
+	{
84
+		$object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', 'descriptive text');
85
+
86
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
87
+
88
+		$object->handleCommand('description', 'Some other lines');
89
+
90
+		$this->assertSame(array(
91
+			'type' => 'integer',
92
+			'description' => 'Some other lines',
93
+		), $object->toArray());
94
+	}
95
+
96
+	protected function setUp(): void
97
+	{
98
+		$this->parent = $this->getMockForAbstractClass(AbstractObject::class);
99
+	}
100
+
101
+	protected function assertPreConditions(): void
102
+	{
103
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
tests/Swagger/TagTest.php 1 patch
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -6,108 +6,108 @@
 block discarded – undo
6 6
 class TagTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Tag::__construct
13
-     * @covers \SwaggerGen\Swagger\License::toArray
14
-     */
15
-    public function testConstructor2()
16
-    {
17
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
18
-
19
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
20
-
21
-        $this->assertSame(array(
22
-            'name' => 'Name',
23
-        ), $object->toArray());
24
-    }
25
-
26
-    /**
27
-     * @covers \SwaggerGen\Swagger\Tag::__construct
28
-     * @covers \SwaggerGen\Swagger\License::toArray
29
-     */
30
-    public function testConstructor_Description_Empty()
31
-    {
32
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', '');
33
-
34
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
35
-
36
-        $this->assertSame(array(
37
-            'name' => 'Name',
38
-        ), $object->toArray());
39
-    }
40
-
41
-    /**
42
-     * @covers \SwaggerGen\Swagger\Tag::__construct
43
-     * @covers \SwaggerGen\Swagger\License::toArray
44
-     */
45
-    public function testConstructor3()
46
-    {
47
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', 'Description');
48
-
49
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
50
-
51
-        $this->assertSame(array(
52
-            'name' => 'Name',
53
-            'description' => 'Description',
54
-        ), $object->toArray());
55
-    }
56
-
57
-    /**
58
-     * @covers \SwaggerGen\Swagger\Tag::getName
59
-     */
60
-    public function testGetName()
61
-    {
62
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
63
-
64
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
65
-
66
-        $this->assertSame('Name', $object->getName());
67
-    }
68
-
69
-    /**
70
-     * @covers \SwaggerGen\Swagger\Tag::handleCommand
71
-     */
72
-    public function testCommandDescription()
73
-    {
74
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
75
-
76
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
77
-
78
-        $object->handleCommand('description', 'Command Description');
79
-
80
-        $this->assertSame(array(
81
-            'name' => 'Name',
82
-            'description' => 'Command Description',
83
-        ), $object->toArray());
84
-    }
85
-
86
-    /**
87
-     * @covers \SwaggerGen\Swagger\Tag::handleCommand
88
-     */
89
-    public function testCommandDescriptionOverwrite()
90
-    {
91
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', 'Description');
92
-
93
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
94
-
95
-        $object->handleCommand('description', 'Command Description');
96
-
97
-        $this->assertSame(array(
98
-            'name' => 'Name',
99
-            'description' => 'Command Description',
100
-        ), $object->toArray());
101
-    }
102
-
103
-    protected function setUp(): void
104
-    {
105
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
106
-    }
107
-
108
-    protected function assertPreConditions(): void
109
-    {
110
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
111
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Tag::__construct
13
+	 * @covers \SwaggerGen\Swagger\License::toArray
14
+	 */
15
+	public function testConstructor2()
16
+	{
17
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
18
+
19
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
20
+
21
+		$this->assertSame(array(
22
+			'name' => 'Name',
23
+		), $object->toArray());
24
+	}
25
+
26
+	/**
27
+	 * @covers \SwaggerGen\Swagger\Tag::__construct
28
+	 * @covers \SwaggerGen\Swagger\License::toArray
29
+	 */
30
+	public function testConstructor_Description_Empty()
31
+	{
32
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', '');
33
+
34
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
35
+
36
+		$this->assertSame(array(
37
+			'name' => 'Name',
38
+		), $object->toArray());
39
+	}
40
+
41
+	/**
42
+	 * @covers \SwaggerGen\Swagger\Tag::__construct
43
+	 * @covers \SwaggerGen\Swagger\License::toArray
44
+	 */
45
+	public function testConstructor3()
46
+	{
47
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', 'Description');
48
+
49
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
50
+
51
+		$this->assertSame(array(
52
+			'name' => 'Name',
53
+			'description' => 'Description',
54
+		), $object->toArray());
55
+	}
56
+
57
+	/**
58
+	 * @covers \SwaggerGen\Swagger\Tag::getName
59
+	 */
60
+	public function testGetName()
61
+	{
62
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
63
+
64
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
65
+
66
+		$this->assertSame('Name', $object->getName());
67
+	}
68
+
69
+	/**
70
+	 * @covers \SwaggerGen\Swagger\Tag::handleCommand
71
+	 */
72
+	public function testCommandDescription()
73
+	{
74
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
75
+
76
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
77
+
78
+		$object->handleCommand('description', 'Command Description');
79
+
80
+		$this->assertSame(array(
81
+			'name' => 'Name',
82
+			'description' => 'Command Description',
83
+		), $object->toArray());
84
+	}
85
+
86
+	/**
87
+	 * @covers \SwaggerGen\Swagger\Tag::handleCommand
88
+	 */
89
+	public function testCommandDescriptionOverwrite()
90
+	{
91
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', 'Description');
92
+
93
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
94
+
95
+		$object->handleCommand('description', 'Command Description');
96
+
97
+		$this->assertSame(array(
98
+			'name' => 'Name',
99
+			'description' => 'Command Description',
100
+		), $object->toArray());
101
+	}
102
+
103
+	protected function setUp(): void
104
+	{
105
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
106
+	}
107
+
108
+	protected function assertPreConditions(): void
109
+	{
110
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
111
+	}
112 112
 
113 113
 }
Please login to merge, or discard this patch.
tests/Swagger/InfoTest.php 1 patch
Indentation   +242 added lines, -242 removed lines patch added patch discarded remove patch
@@ -7,247 +7,247 @@
 block discarded – undo
7 7
 class InfoTest extends TestCase
8 8
 {
9 9
 
10
-    protected $parent;
11
-
12
-    /**
13
-     * @covers \SwaggerGen\Swagger\Info
14
-     */
15
-    public function testNoConstructor(): void
16
-    {
17
-        $object = new \SwaggerGen\Swagger\Info;
18
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
19
-
20
-        $this->assertSame(array(
21
-            'title' => 'undefined',
22
-            'version' => '0',
23
-        ), $object->toArray());
24
-    }
25
-
26
-    /**
27
-     * @covers \SwaggerGen\Swagger\Info::handleCommand
28
-     */
29
-    public function testCommandTitle()
30
-    {
31
-        $object = new \SwaggerGen\Swagger\Info;
32
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
33
-
34
-        $object->handleCommand('title', 'This is the title');
35
-
36
-        $this->assertSame(array(
37
-            'title' => 'This is the title',
38
-            'version' => '0',
39
-        ), $object->toArray());
40
-    }
41
-
42
-    /**
43
-     * @covers \SwaggerGen\Swagger\Info::handleCommand
44
-     */
45
-    public function testCommandDescription()
46
-    {
47
-        $object = new \SwaggerGen\Swagger\Info;
48
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
49
-
50
-        $object->handleCommand('description', 'This is the description');
51
-
52
-        $this->assertSame(array(
53
-            'title' => 'undefined',
54
-            'description' => 'This is the description',
55
-            'version' => '0',
56
-        ), $object->toArray());
57
-    }
58
-
59
-    /**
60
-     * @covers \SwaggerGen\Swagger\Info::handleCommand
61
-     */
62
-    public function testCommandVersion()
63
-    {
64
-        $object = new \SwaggerGen\Swagger\Info;
65
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
66
-
67
-        $object->handleCommand('version', '1.2.3a');
68
-
69
-        $this->assertSame(array(
70
-            'title' => 'undefined',
71
-            'version' => '1.2.3a',
72
-        ), $object->toArray());
73
-    }
74
-
75
-    /**
76
-     * @covers \SwaggerGen\Swagger\Info::handleCommand
77
-     */
78
-    public function testCommandTermsofservice()
79
-    {
80
-        $object = new \SwaggerGen\Swagger\Info;
81
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
82
-
83
-        $object->handleCommand('termsofservice', 'These are the terms');
84
-
85
-        $this->assertSame(array(
86
-            'title' => 'undefined',
87
-            'termsOfService' => 'These are the terms',
88
-            'version' => '0',
89
-        ), $object->toArray());
90
-    }
91
-
92
-    /**
93
-     * @covers \SwaggerGen\Swagger\Info::handleCommand
94
-     */
95
-    public function testCommandTerms()
96
-    {
97
-        $object = new \SwaggerGen\Swagger\Info;
98
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
99
-
100
-        $object->handleCommand('terms', 'These are the terms');
101
-
102
-        $this->assertSame(array(
103
-            'title' => 'undefined',
104
-            'termsOfService' => 'These are the terms',
105
-            'version' => '0',
106
-        ), $object->toArray());
107
-    }
108
-
109
-    /**
110
-     * @covers \SwaggerGen\Swagger\Info::handleCommand
111
-     */
112
-    public function testCommandContactNameUrlEmail()
113
-    {
114
-        $object = new \SwaggerGen\Swagger\Info;
115
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
116
-
117
-        $object->handleCommand('contact', 'Arthur D. Author http://example.test [email protected]');
118
-
119
-        $this->assertSame(array(
120
-            'title' => 'undefined',
121
-            'contact' => array(
122
-                'name' => 'Arthur D. Author',
123
-                'url' => 'http://example.test',
124
-                'email' => '[email protected]',
125
-            ),
126
-            'version' => '0',
127
-        ), $object->toArray());
128
-    }
129
-
130
-    /**
131
-     * @covers \SwaggerGen\Swagger\Info::handleCommand
132
-     */
133
-    public function testCommandContactNameEmailNameUrlName()
134
-    {
135
-        $object = new \SwaggerGen\Swagger\Info;
136
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
137
-
138
-        $object->handleCommand('contact', 'Arthur [email protected] D. http://example.test Author    ');
139
-
140
-        $this->assertSame(array(
141
-            'title' => 'undefined',
142
-            'contact' => array(
143
-                'name' => 'Arthur D. Author',
144
-                'url' => 'http://example.test',
145
-                'email' => '[email protected]',
146
-            ),
147
-            'version' => '0',
148
-        ), $object->toArray());
149
-    }
150
-
151
-    /**
152
-     * @covers \SwaggerGen\Swagger\Info::handleCommand
153
-     */
154
-    public function testCommandLicenseNameUrl()
155
-    {
156
-        $object = new \SwaggerGen\Swagger\Info;
157
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
158
-
159
-        $object->handleCommand('license', 'NAME http://example.test');
160
-
161
-        $this->assertSame(array(
162
-            'title' => 'undefined',
163
-            'license' => array(
164
-                'name' => 'NAME',
165
-                'url' => 'http://example.test',
166
-            ),
167
-            'version' => '0',
168
-        ), $object->toArray());
169
-    }
170
-
171
-    /**
172
-     * @covers \SwaggerGen\Swagger\Info::handleCommand
173
-     */
174
-    public function testCommandLicenseUrlName()
175
-    {
176
-        $object = new \SwaggerGen\Swagger\Info;
177
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
178
-
179
-        $object->handleCommand('license', 'http://example.test NAME');
180
-
181
-        $this->assertSame(array(
182
-            'title' => 'undefined',
183
-            'license' => array(
184
-                'name' => 'NAME',
185
-                'url' => 'http://example.test',
186
-            ),
187
-            'version' => '0',
188
-        ), $object->toArray());
189
-    }
190
-
191
-    /**
192
-     * @covers \SwaggerGen\Swagger\Info::handleCommand
193
-     */
194
-    public function testCommandLicenseShorthand()
195
-    {
196
-        $object = new \SwaggerGen\Swagger\Info;
197
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
198
-
199
-        $object->handleCommand('license', 'BSD');
200
-
201
-        $this->assertSame(array(
202
-            'title' => 'undefined',
203
-            'license' => array(
204
-                'name' => 'BSD',
205
-                'url' => 'https://opensource.org/licenses/BSD-2-Clause',
206
-            ),
207
-            'version' => '0',
208
-        ), $object->toArray());
209
-    }
210
-
211
-    /**
212
-     * @covers \SwaggerGen\Swagger\Info::handleCommand
213
-     */
214
-    public function testCommandAll()
215
-    {
216
-        $object = new \SwaggerGen\Swagger\Info;
217
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
218
-
219
-        $object->handleCommand('description', 'This is the description');
220
-        $object->handleCommand('license', 'BSD');
221
-        $object->handleCommand('terms', 'These are the terms');
222
-        $object->handleCommand('version', '1.2.3a');
223
-        $object->handleCommand('title', 'This is the title');
224
-        $object->handleCommand('contact', 'Arthur D. Author http://example.test [email protected]');
225
-
226
-        $this->assertSame(array(
227
-            'title' => 'This is the title',
228
-            'description' => 'This is the description',
229
-            'termsOfService' => 'These are the terms',
230
-            'contact' => array(
231
-                'name' => 'Arthur D. Author',
232
-                'url' => 'http://example.test',
233
-                'email' => '[email protected]',
234
-            ),
235
-            'license' => array(
236
-                'name' => 'BSD',
237
-                'url' => 'https://opensource.org/licenses/BSD-2-Clause',
238
-            ),
239
-            'version' => '1.2.3a',
240
-        ), $object->toArray());
241
-    }
242
-
243
-    protected function setUp(): void
244
-    {
245
-        $this->parent = $this->getMockForAbstractClass(AbstractObject::class);
246
-    }
247
-
248
-    protected function assertPreConditions(): void
249
-    {
250
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
251
-    }
10
+	protected $parent;
11
+
12
+	/**
13
+	 * @covers \SwaggerGen\Swagger\Info
14
+	 */
15
+	public function testNoConstructor(): void
16
+	{
17
+		$object = new \SwaggerGen\Swagger\Info;
18
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
19
+
20
+		$this->assertSame(array(
21
+			'title' => 'undefined',
22
+			'version' => '0',
23
+		), $object->toArray());
24
+	}
25
+
26
+	/**
27
+	 * @covers \SwaggerGen\Swagger\Info::handleCommand
28
+	 */
29
+	public function testCommandTitle()
30
+	{
31
+		$object = new \SwaggerGen\Swagger\Info;
32
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
33
+
34
+		$object->handleCommand('title', 'This is the title');
35
+
36
+		$this->assertSame(array(
37
+			'title' => 'This is the title',
38
+			'version' => '0',
39
+		), $object->toArray());
40
+	}
41
+
42
+	/**
43
+	 * @covers \SwaggerGen\Swagger\Info::handleCommand
44
+	 */
45
+	public function testCommandDescription()
46
+	{
47
+		$object = new \SwaggerGen\Swagger\Info;
48
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
49
+
50
+		$object->handleCommand('description', 'This is the description');
51
+
52
+		$this->assertSame(array(
53
+			'title' => 'undefined',
54
+			'description' => 'This is the description',
55
+			'version' => '0',
56
+		), $object->toArray());
57
+	}
58
+
59
+	/**
60
+	 * @covers \SwaggerGen\Swagger\Info::handleCommand
61
+	 */
62
+	public function testCommandVersion()
63
+	{
64
+		$object = new \SwaggerGen\Swagger\Info;
65
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
66
+
67
+		$object->handleCommand('version', '1.2.3a');
68
+
69
+		$this->assertSame(array(
70
+			'title' => 'undefined',
71
+			'version' => '1.2.3a',
72
+		), $object->toArray());
73
+	}
74
+
75
+	/**
76
+	 * @covers \SwaggerGen\Swagger\Info::handleCommand
77
+	 */
78
+	public function testCommandTermsofservice()
79
+	{
80
+		$object = new \SwaggerGen\Swagger\Info;
81
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
82
+
83
+		$object->handleCommand('termsofservice', 'These are the terms');
84
+
85
+		$this->assertSame(array(
86
+			'title' => 'undefined',
87
+			'termsOfService' => 'These are the terms',
88
+			'version' => '0',
89
+		), $object->toArray());
90
+	}
91
+
92
+	/**
93
+	 * @covers \SwaggerGen\Swagger\Info::handleCommand
94
+	 */
95
+	public function testCommandTerms()
96
+	{
97
+		$object = new \SwaggerGen\Swagger\Info;
98
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
99
+
100
+		$object->handleCommand('terms', 'These are the terms');
101
+
102
+		$this->assertSame(array(
103
+			'title' => 'undefined',
104
+			'termsOfService' => 'These are the terms',
105
+			'version' => '0',
106
+		), $object->toArray());
107
+	}
108
+
109
+	/**
110
+	 * @covers \SwaggerGen\Swagger\Info::handleCommand
111
+	 */
112
+	public function testCommandContactNameUrlEmail()
113
+	{
114
+		$object = new \SwaggerGen\Swagger\Info;
115
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
116
+
117
+		$object->handleCommand('contact', 'Arthur D. Author http://example.test [email protected]');
118
+
119
+		$this->assertSame(array(
120
+			'title' => 'undefined',
121
+			'contact' => array(
122
+				'name' => 'Arthur D. Author',
123
+				'url' => 'http://example.test',
124
+				'email' => '[email protected]',
125
+			),
126
+			'version' => '0',
127
+		), $object->toArray());
128
+	}
129
+
130
+	/**
131
+	 * @covers \SwaggerGen\Swagger\Info::handleCommand
132
+	 */
133
+	public function testCommandContactNameEmailNameUrlName()
134
+	{
135
+		$object = new \SwaggerGen\Swagger\Info;
136
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
137
+
138
+		$object->handleCommand('contact', 'Arthur [email protected] D. http://example.test Author    ');
139
+
140
+		$this->assertSame(array(
141
+			'title' => 'undefined',
142
+			'contact' => array(
143
+				'name' => 'Arthur D. Author',
144
+				'url' => 'http://example.test',
145
+				'email' => '[email protected]',
146
+			),
147
+			'version' => '0',
148
+		), $object->toArray());
149
+	}
150
+
151
+	/**
152
+	 * @covers \SwaggerGen\Swagger\Info::handleCommand
153
+	 */
154
+	public function testCommandLicenseNameUrl()
155
+	{
156
+		$object = new \SwaggerGen\Swagger\Info;
157
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
158
+
159
+		$object->handleCommand('license', 'NAME http://example.test');
160
+
161
+		$this->assertSame(array(
162
+			'title' => 'undefined',
163
+			'license' => array(
164
+				'name' => 'NAME',
165
+				'url' => 'http://example.test',
166
+			),
167
+			'version' => '0',
168
+		), $object->toArray());
169
+	}
170
+
171
+	/**
172
+	 * @covers \SwaggerGen\Swagger\Info::handleCommand
173
+	 */
174
+	public function testCommandLicenseUrlName()
175
+	{
176
+		$object = new \SwaggerGen\Swagger\Info;
177
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
178
+
179
+		$object->handleCommand('license', 'http://example.test NAME');
180
+
181
+		$this->assertSame(array(
182
+			'title' => 'undefined',
183
+			'license' => array(
184
+				'name' => 'NAME',
185
+				'url' => 'http://example.test',
186
+			),
187
+			'version' => '0',
188
+		), $object->toArray());
189
+	}
190
+
191
+	/**
192
+	 * @covers \SwaggerGen\Swagger\Info::handleCommand
193
+	 */
194
+	public function testCommandLicenseShorthand()
195
+	{
196
+		$object = new \SwaggerGen\Swagger\Info;
197
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
198
+
199
+		$object->handleCommand('license', 'BSD');
200
+
201
+		$this->assertSame(array(
202
+			'title' => 'undefined',
203
+			'license' => array(
204
+				'name' => 'BSD',
205
+				'url' => 'https://opensource.org/licenses/BSD-2-Clause',
206
+			),
207
+			'version' => '0',
208
+		), $object->toArray());
209
+	}
210
+
211
+	/**
212
+	 * @covers \SwaggerGen\Swagger\Info::handleCommand
213
+	 */
214
+	public function testCommandAll()
215
+	{
216
+		$object = new \SwaggerGen\Swagger\Info;
217
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Info', $object);
218
+
219
+		$object->handleCommand('description', 'This is the description');
220
+		$object->handleCommand('license', 'BSD');
221
+		$object->handleCommand('terms', 'These are the terms');
222
+		$object->handleCommand('version', '1.2.3a');
223
+		$object->handleCommand('title', 'This is the title');
224
+		$object->handleCommand('contact', 'Arthur D. Author http://example.test [email protected]');
225
+
226
+		$this->assertSame(array(
227
+			'title' => 'This is the title',
228
+			'description' => 'This is the description',
229
+			'termsOfService' => 'These are the terms',
230
+			'contact' => array(
231
+				'name' => 'Arthur D. Author',
232
+				'url' => 'http://example.test',
233
+				'email' => '[email protected]',
234
+			),
235
+			'license' => array(
236
+				'name' => 'BSD',
237
+				'url' => 'https://opensource.org/licenses/BSD-2-Clause',
238
+			),
239
+			'version' => '1.2.3a',
240
+		), $object->toArray());
241
+	}
242
+
243
+	protected function setUp(): void
244
+	{
245
+		$this->parent = $this->getMockForAbstractClass(AbstractObject::class);
246
+	}
247
+
248
+	protected function assertPreConditions(): void
249
+	{
250
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
251
+	}
252 252
 
253 253
 }
Please login to merge, or discard this patch.
tests/Swagger/ResponseTest.php 1 patch
Indentation   +398 added lines, -398 removed lines patch added patch discarded remove patch
@@ -6,403 +6,403 @@
 block discarded – undo
6 6
 class ResponseTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Response::__construct
13
-     */
14
-    public function testConstructor_200()
15
-    {
16
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
17
-
18
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
19
-
20
-        $this->assertSame(array(
21
-            'description' => 'OK',
22
-        ), $object->toArray());
23
-    }
24
-
25
-    /**
26
-     * @covers \SwaggerGen\Swagger\Response::__construct
27
-     */
28
-    public function testConstructor_404Type()
29
-    {
30
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 404);
31
-
32
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
33
-
34
-        $this->assertSame(array(
35
-            'description' => 'Not Found',
36
-        ), $object->toArray());
37
-    }
38
-
39
-    /**
40
-     * @covers \SwaggerGen\Swagger\Response::__construct
41
-     */
42
-    public function testConstructor_Type()
43
-    {
44
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200, 'int');
45
-
46
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
47
-
48
-        $this->assertSame(array(
49
-            'description' => 'OK',
50
-            'schema' => array(
51
-                'type' => 'integer',
52
-                'format' => 'int32',
53
-            ),
54
-        ), $object->toArray());
55
-    }
56
-
57
-    /**
58
-     * @covers \SwaggerGen\Swagger\Response::__construct
59
-     */
60
-    public function testConstructor_Reference()
61
-    {
62
-        $this->parent->handleCommand('model', 'User');
63
-
64
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200, 'User');
65
-
66
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
67
-
68
-        $this->assertSame(array(
69
-            'description' => 'OK',
70
-            'schema' => array(
71
-                '$ref' => '#/definitions/User',
72
-            ),
73
-        ), $object->toArray());
74
-    }
75
-
76
-    /**
77
-     * @covers \SwaggerGen\Swagger\Response::__construct
78
-     */
79
-    public function testConstructor_Description()
80
-    {
81
-        $object = new \SwaggerGen\Swagger\Response($this->parent, '200', null, 'Fine And Dandy');
82
-
83
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
84
-
85
-        $this->assertSame(array(
86
-            'description' => 'Fine And Dandy',
87
-        ), $object->toArray());
88
-    }
89
-
90
-    /**
91
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
92
-     */
93
-    public function testCommand_Header_NoType()
94
-    {
95
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
96
-
97
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
98
-
99
-        $this->expectException('\SwaggerGen\Exception', "Missing type for header");
100
-
101
-        $object->handleCommand('header', '');
102
-    }
103
-
104
-    /**
105
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
106
-     */
107
-    public function testCommand_Header_NoName()
108
-    {
109
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
110
-
111
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
112
-
113
-        $this->expectException('\SwaggerGen\Exception', "Missing name for header type 'int'");
114
-
115
-        $object->handleCommand('header', 'int');
116
-    }
117
-
118
-    /**
119
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
120
-     */
121
-    public function testCommand_Header_InvalidType()
122
-    {
123
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
124
-
125
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
126
-
127
-        $this->expectException('\SwaggerGen\Exception', "Header type not valid: 'foo'");
128
-
129
-        $object->handleCommand('header', 'foo bar');
130
-    }
131
-
132
-    /**
133
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
134
-     */
135
-    public function testCommand_Header()
136
-    {
137
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
138
-
139
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
140
-
141
-        $object->handleCommand('header', 'integer bar');
142
-
143
-        $this->assertSame(array(
144
-            'description' => 'OK',
145
-            'headers' => array(
146
-                'bar' => array(
147
-                    'type' => 'integer',
148
-                ),
149
-            ),
150
-        ), $object->toArray());
151
-    }
152
-
153
-    /**
154
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
155
-     */
156
-    public function testCommand_Header_Description()
157
-    {
158
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
159
-
160
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
161
-
162
-        $object->handleCommand('header', 'integer bar Some text');
163
-
164
-        $this->assertSame(array(
165
-            'description' => 'OK',
166
-            'headers' => array(
167
-                'bar' => array(
168
-                    'type' => 'integer',
169
-                    'description' => 'Some text',
170
-                ),
171
-            ),
172
-        ), $object->toArray());
173
-    }
174
-
175
-    /**
176
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
177
-     */
178
-    public function testCommand_Header_Multiple()
179
-    {
180
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
181
-
182
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
183
-
184
-        $object->handleCommand('header', 'integer bar');
185
-        $object->handleCommand('header', 'string X-Whatever');
186
-
187
-        $this->assertSame(array(
188
-            'description' => 'OK',
189
-            'headers' => array(
190
-                'bar' => array(
191
-                    'type' => 'integer',
192
-                ),
193
-                'X-Whatever' => array(
194
-                    'type' => 'string',
195
-                ),
196
-            ),
197
-        ), $object->toArray());
198
-    }
199
-
200
-    /**
201
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
202
-     */
203
-    public function testCommand_Example_NoName()
204
-    {
205
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
206
-
207
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
208
-
209
-        $this->expectException('\SwaggerGen\Exception', "Missing name for example");
210
-
211
-        $object->handleCommand('example', '');
212
-    }
213
-
214
-    /**
215
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
216
-     */
217
-    public function testCommand_Example_NoData()
218
-    {
219
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
220
-
221
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
222
-
223
-        $this->expectException('\SwaggerGen\Exception', "Missing content for example `Foo`");
224
-
225
-        $object->handleCommand('example', 'Foo');
226
-    }
227
-
228
-    /**
229
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
230
-     */
231
-    public function testCommand_Example_Text()
232
-    {
233
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
234
-
235
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
236
-
237
-        $object->handleCommand('example', 'Foo bar');
238
-
239
-        $this->assertSame(array(
240
-            'description' => 'OK',
241
-            'examples' => array(
242
-                'Foo' => 'bar',
243
-            ),
244
-        ), $object->toArray());
245
-    }
246
-
247
-    /**
248
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
249
-     */
250
-    public function testCommand_Example_Number()
251
-    {
252
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
253
-
254
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
255
-
256
-        $object->handleCommand('example', 'Foo 123.45');
257
-
258
-        $this->assertSame(array(
259
-            'description' => 'OK',
260
-            'examples' => array(
261
-                'Foo' => 123.45,
262
-            ),
263
-        ), $object->toArray());
264
-    }
265
-
266
-    /**
267
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
268
-     */
269
-    public function testCommand_Example_Json()
270
-    {
271
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
272
-
273
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
274
-
275
-        $object->handleCommand('example', 'Foo {"bar":"baz"}');
276
-
277
-        $this->assertSame(array(
278
-            'description' => 'OK',
279
-            'examples' => array(
280
-                'Foo' => array(
281
-                    'bar' => 'baz',
282
-                ),
283
-            ),
284
-        ), $object->toArray());
285
-    }
286
-
287
-    /**
288
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
289
-     */
290
-    public function testCommand_Example_Json_Unquoted()
291
-    {
292
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
293
-
294
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
295
-
296
-        $object->handleCommand('example', 'Foo {bar:baz}');
297
-
298
-        $this->assertSame(array(
299
-            'description' => 'OK',
300
-            'examples' => array(
301
-                'Foo' => array(
302
-                    'bar' => 'baz',
303
-                ),
304
-            ),
305
-        ), $object->toArray());
306
-    }
307
-
308
-    /**
309
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
310
-     */
311
-    public function testCommand_Example_Json_Whitespace()
312
-    {
313
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
314
-
315
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
316
-
317
-        $object->handleCommand('example', 'Foo   { "bar" : "baz" } ');
318
-
319
-        $this->assertSame(array(
320
-            'description' => 'OK',
321
-            'examples' => array(
322
-                'Foo' => array(
323
-                    'bar' => 'baz',
324
-                ),
325
-            ),
326
-        ), $object->toArray());
327
-    }
328
-
329
-    /**
330
-     * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
331
-     */
332
-    public function testCommand_Example_Json_Multiple()
333
-    {
334
-        $object = new \SwaggerGen\Swagger\Response($this->parent, 200);
335
-
336
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
337
-
338
-        $object->handleCommand('example', 'Foo   "Bar"  ');
339
-        $object->handleCommand('example', 'Baz  false');
340
-
341
-        $this->assertSame(array(
342
-            'description' => 'OK',
343
-            'examples' => array(
344
-                'Foo' => 'Bar',
345
-                'Baz' => false,
346
-            ),
347
-        ), $object->toArray());
348
-    }
349
-
350
-    /**
351
-     * @covers \SwaggerGen\Swagger\Type\Response->getCode
352
-     */
353
-    public function testGetCode_Numeric()
354
-    {
355
-        $this->assertSame(200, \SwaggerGen\Swagger\Response::getCode(200));
356
-    }
357
-
358
-    /**
359
-     * @covers \SwaggerGen\Swagger\Type\Response->getCode
360
-     */
361
-    public function testGetCode_CaseSensitive()
362
-    {
363
-        $this->assertSame(200, \SwaggerGen\Swagger\Response::getCode('OK'));
364
-    }
365
-
366
-    /**
367
-     * @covers \SwaggerGen\Swagger\Type\Response->getCode
368
-     */
369
-    public function testGetCode_CaseInsensitive()
370
-    {
371
-        $this->assertSame(200, \SwaggerGen\Swagger\Response::getCode('ok'));
372
-    }
373
-
374
-    /**
375
-     * @covers \SwaggerGen\Swagger\Type\Response->getCode
376
-     */
377
-    public function testGetCode_Space()
378
-    {
379
-        $this->assertSame(404, \SwaggerGen\Swagger\Response::getCode('not Found'));
380
-    }
381
-
382
-    /**
383
-     * @covers \SwaggerGen\Swagger\Type\Response->getCode
384
-     */
385
-    public function testGetCode_Crap()
386
-    {
387
-        $this->assertSame(404, \SwaggerGen\Swagger\Response::getCode(' not___F-ou/nd  '));
388
-    }
389
-
390
-    /**
391
-     * @covers \SwaggerGen\Swagger\Type\Response->getCode
392
-     */
393
-    public function testGetCode_Smashed()
394
-    {
395
-        $this->assertSame(404, \SwaggerGen\Swagger\Response::getCode('nOtfOund'));
396
-    }
397
-
398
-    protected function setUp(): void
399
-    {
400
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
401
-    }
402
-
403
-    protected function assertPreConditions(): void
404
-    {
405
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
406
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Response::__construct
13
+	 */
14
+	public function testConstructor_200()
15
+	{
16
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
17
+
18
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
19
+
20
+		$this->assertSame(array(
21
+			'description' => 'OK',
22
+		), $object->toArray());
23
+	}
24
+
25
+	/**
26
+	 * @covers \SwaggerGen\Swagger\Response::__construct
27
+	 */
28
+	public function testConstructor_404Type()
29
+	{
30
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 404);
31
+
32
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
33
+
34
+		$this->assertSame(array(
35
+			'description' => 'Not Found',
36
+		), $object->toArray());
37
+	}
38
+
39
+	/**
40
+	 * @covers \SwaggerGen\Swagger\Response::__construct
41
+	 */
42
+	public function testConstructor_Type()
43
+	{
44
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200, 'int');
45
+
46
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
47
+
48
+		$this->assertSame(array(
49
+			'description' => 'OK',
50
+			'schema' => array(
51
+				'type' => 'integer',
52
+				'format' => 'int32',
53
+			),
54
+		), $object->toArray());
55
+	}
56
+
57
+	/**
58
+	 * @covers \SwaggerGen\Swagger\Response::__construct
59
+	 */
60
+	public function testConstructor_Reference()
61
+	{
62
+		$this->parent->handleCommand('model', 'User');
63
+
64
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200, 'User');
65
+
66
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
67
+
68
+		$this->assertSame(array(
69
+			'description' => 'OK',
70
+			'schema' => array(
71
+				'$ref' => '#/definitions/User',
72
+			),
73
+		), $object->toArray());
74
+	}
75
+
76
+	/**
77
+	 * @covers \SwaggerGen\Swagger\Response::__construct
78
+	 */
79
+	public function testConstructor_Description()
80
+	{
81
+		$object = new \SwaggerGen\Swagger\Response($this->parent, '200', null, 'Fine And Dandy');
82
+
83
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
84
+
85
+		$this->assertSame(array(
86
+			'description' => 'Fine And Dandy',
87
+		), $object->toArray());
88
+	}
89
+
90
+	/**
91
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
92
+	 */
93
+	public function testCommand_Header_NoType()
94
+	{
95
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
96
+
97
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
98
+
99
+		$this->expectException('\SwaggerGen\Exception', "Missing type for header");
100
+
101
+		$object->handleCommand('header', '');
102
+	}
103
+
104
+	/**
105
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
106
+	 */
107
+	public function testCommand_Header_NoName()
108
+	{
109
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
110
+
111
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
112
+
113
+		$this->expectException('\SwaggerGen\Exception', "Missing name for header type 'int'");
114
+
115
+		$object->handleCommand('header', 'int');
116
+	}
117
+
118
+	/**
119
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
120
+	 */
121
+	public function testCommand_Header_InvalidType()
122
+	{
123
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
124
+
125
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
126
+
127
+		$this->expectException('\SwaggerGen\Exception', "Header type not valid: 'foo'");
128
+
129
+		$object->handleCommand('header', 'foo bar');
130
+	}
131
+
132
+	/**
133
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
134
+	 */
135
+	public function testCommand_Header()
136
+	{
137
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
138
+
139
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
140
+
141
+		$object->handleCommand('header', 'integer bar');
142
+
143
+		$this->assertSame(array(
144
+			'description' => 'OK',
145
+			'headers' => array(
146
+				'bar' => array(
147
+					'type' => 'integer',
148
+				),
149
+			),
150
+		), $object->toArray());
151
+	}
152
+
153
+	/**
154
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
155
+	 */
156
+	public function testCommand_Header_Description()
157
+	{
158
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
159
+
160
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
161
+
162
+		$object->handleCommand('header', 'integer bar Some text');
163
+
164
+		$this->assertSame(array(
165
+			'description' => 'OK',
166
+			'headers' => array(
167
+				'bar' => array(
168
+					'type' => 'integer',
169
+					'description' => 'Some text',
170
+				),
171
+			),
172
+		), $object->toArray());
173
+	}
174
+
175
+	/**
176
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
177
+	 */
178
+	public function testCommand_Header_Multiple()
179
+	{
180
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
181
+
182
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
183
+
184
+		$object->handleCommand('header', 'integer bar');
185
+		$object->handleCommand('header', 'string X-Whatever');
186
+
187
+		$this->assertSame(array(
188
+			'description' => 'OK',
189
+			'headers' => array(
190
+				'bar' => array(
191
+					'type' => 'integer',
192
+				),
193
+				'X-Whatever' => array(
194
+					'type' => 'string',
195
+				),
196
+			),
197
+		), $object->toArray());
198
+	}
199
+
200
+	/**
201
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
202
+	 */
203
+	public function testCommand_Example_NoName()
204
+	{
205
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
206
+
207
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
208
+
209
+		$this->expectException('\SwaggerGen\Exception', "Missing name for example");
210
+
211
+		$object->handleCommand('example', '');
212
+	}
213
+
214
+	/**
215
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
216
+	 */
217
+	public function testCommand_Example_NoData()
218
+	{
219
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
220
+
221
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
222
+
223
+		$this->expectException('\SwaggerGen\Exception', "Missing content for example `Foo`");
224
+
225
+		$object->handleCommand('example', 'Foo');
226
+	}
227
+
228
+	/**
229
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
230
+	 */
231
+	public function testCommand_Example_Text()
232
+	{
233
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
234
+
235
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
236
+
237
+		$object->handleCommand('example', 'Foo bar');
238
+
239
+		$this->assertSame(array(
240
+			'description' => 'OK',
241
+			'examples' => array(
242
+				'Foo' => 'bar',
243
+			),
244
+		), $object->toArray());
245
+	}
246
+
247
+	/**
248
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
249
+	 */
250
+	public function testCommand_Example_Number()
251
+	{
252
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
253
+
254
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
255
+
256
+		$object->handleCommand('example', 'Foo 123.45');
257
+
258
+		$this->assertSame(array(
259
+			'description' => 'OK',
260
+			'examples' => array(
261
+				'Foo' => 123.45,
262
+			),
263
+		), $object->toArray());
264
+	}
265
+
266
+	/**
267
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
268
+	 */
269
+	public function testCommand_Example_Json()
270
+	{
271
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
272
+
273
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
274
+
275
+		$object->handleCommand('example', 'Foo {"bar":"baz"}');
276
+
277
+		$this->assertSame(array(
278
+			'description' => 'OK',
279
+			'examples' => array(
280
+				'Foo' => array(
281
+					'bar' => 'baz',
282
+				),
283
+			),
284
+		), $object->toArray());
285
+	}
286
+
287
+	/**
288
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
289
+	 */
290
+	public function testCommand_Example_Json_Unquoted()
291
+	{
292
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
293
+
294
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
295
+
296
+		$object->handleCommand('example', 'Foo {bar:baz}');
297
+
298
+		$this->assertSame(array(
299
+			'description' => 'OK',
300
+			'examples' => array(
301
+				'Foo' => array(
302
+					'bar' => 'baz',
303
+				),
304
+			),
305
+		), $object->toArray());
306
+	}
307
+
308
+	/**
309
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
310
+	 */
311
+	public function testCommand_Example_Json_Whitespace()
312
+	{
313
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
314
+
315
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
316
+
317
+		$object->handleCommand('example', 'Foo   { "bar" : "baz" } ');
318
+
319
+		$this->assertSame(array(
320
+			'description' => 'OK',
321
+			'examples' => array(
322
+				'Foo' => array(
323
+					'bar' => 'baz',
324
+				),
325
+			),
326
+		), $object->toArray());
327
+	}
328
+
329
+	/**
330
+	 * @covers \SwaggerGen\Swagger\Type\Response->handleCommand
331
+	 */
332
+	public function testCommand_Example_Json_Multiple()
333
+	{
334
+		$object = new \SwaggerGen\Swagger\Response($this->parent, 200);
335
+
336
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Response', $object);
337
+
338
+		$object->handleCommand('example', 'Foo   "Bar"  ');
339
+		$object->handleCommand('example', 'Baz  false');
340
+
341
+		$this->assertSame(array(
342
+			'description' => 'OK',
343
+			'examples' => array(
344
+				'Foo' => 'Bar',
345
+				'Baz' => false,
346
+			),
347
+		), $object->toArray());
348
+	}
349
+
350
+	/**
351
+	 * @covers \SwaggerGen\Swagger\Type\Response->getCode
352
+	 */
353
+	public function testGetCode_Numeric()
354
+	{
355
+		$this->assertSame(200, \SwaggerGen\Swagger\Response::getCode(200));
356
+	}
357
+
358
+	/**
359
+	 * @covers \SwaggerGen\Swagger\Type\Response->getCode
360
+	 */
361
+	public function testGetCode_CaseSensitive()
362
+	{
363
+		$this->assertSame(200, \SwaggerGen\Swagger\Response::getCode('OK'));
364
+	}
365
+
366
+	/**
367
+	 * @covers \SwaggerGen\Swagger\Type\Response->getCode
368
+	 */
369
+	public function testGetCode_CaseInsensitive()
370
+	{
371
+		$this->assertSame(200, \SwaggerGen\Swagger\Response::getCode('ok'));
372
+	}
373
+
374
+	/**
375
+	 * @covers \SwaggerGen\Swagger\Type\Response->getCode
376
+	 */
377
+	public function testGetCode_Space()
378
+	{
379
+		$this->assertSame(404, \SwaggerGen\Swagger\Response::getCode('not Found'));
380
+	}
381
+
382
+	/**
383
+	 * @covers \SwaggerGen\Swagger\Type\Response->getCode
384
+	 */
385
+	public function testGetCode_Crap()
386
+	{
387
+		$this->assertSame(404, \SwaggerGen\Swagger\Response::getCode(' not___F-ou/nd  '));
388
+	}
389
+
390
+	/**
391
+	 * @covers \SwaggerGen\Swagger\Type\Response->getCode
392
+	 */
393
+	public function testGetCode_Smashed()
394
+	{
395
+		$this->assertSame(404, \SwaggerGen\Swagger\Response::getCode('nOtfOund'));
396
+	}
397
+
398
+	protected function setUp(): void
399
+	{
400
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
401
+	}
402
+
403
+	protected function assertPreConditions(): void
404
+	{
405
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
406
+	}
407 407
 
408 408
 }
Please login to merge, or discard this patch.
tests/Swagger/SecuritySchemeTest.php 1 patch
Indentation   +489 added lines, -489 removed lines patch added patch discarded remove patch
@@ -6,494 +6,494 @@
 block discarded – undo
6 6
 class SecuritySchemeTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
13
-     */
14
-    public function testConstructor_UnknownType()
15
-    {
16
-        $this->expectException('\SwaggerGen\Exception', "Security scheme type must be either 'basic', 'apiKey' or 'oauth2', not 'wrong'");
17
-
18
-        new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'wrong');
19
-    }
20
-
21
-    /**
22
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
23
-     */
24
-    public function testConstructor_Basic()
25
-    {
26
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'basic');
27
-
28
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
29
-
30
-        $this->assertSame(array(
31
-            'type' => 'basic',
32
-        ), $object->toArray());
33
-    }
34
-
35
-    /**
36
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
37
-     */
38
-    public function testConstructor_BasicDescription()
39
-    {
40
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'basic', 'Some text');
41
-
42
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
43
-
44
-        $this->assertSame(array(
45
-            'type' => 'basic',
46
-            'description' => 'Some text',
47
-        ), $object->toArray());
48
-    }
49
-
50
-    /**
51
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
52
-     */
53
-    public function testConstructor_ApiKeyNoName()
54
-    {
55
-        $this->expectException('\SwaggerGen\Exception', "ApiKey in must be either 'query' or 'header', not ''"
56
-        );
57
-
58
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'apikey');
59
-    }
60
-
61
-    /**
62
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
63
-     */
64
-    public function testConstructor_ApiKeyNoIn()
65
-    {
66
-        $this->expectException('\SwaggerGen\Exception', "ApiKey in must be either 'query' or 'header', not ''");
67
-
68
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'apikey', 'Name');
69
-    }
70
-
71
-    /**
72
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
73
-     */
74
-    public function testConstructor_ApiKeyWrongIn()
75
-    {
76
-        $this->expectException('\SwaggerGen\Exception', "ApiKey in must be either 'query' or 'header', not 'bad'");
77
-
78
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'apikey', 'Name bad');
79
-    }
80
-
81
-    /**
82
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
83
-     */
84
-    public function testConstructor_ApiKey()
85
-    {
86
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'apikey', 'Name query');
87
-
88
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
89
-
90
-        $this->assertSame(array(
91
-            'type' => 'apiKey',
92
-            'name' => 'Name',
93
-            'in' => 'query',
94
-        ), $object->toArray());
95
-    }
96
-
97
-    /**
98
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
99
-     */
100
-    public function testConstructor_ApiKeyDescription()
101
-    {
102
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'apikey', 'Name query Some words');
103
-
104
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
105
-
106
-        $this->assertSame(array(
107
-            'type' => 'apiKey',
108
-            'description' => 'Some words',
109
-            'name' => 'Name',
110
-            'in' => 'query',
111
-        ), $object->toArray());
112
-    }
113
-
114
-    /**
115
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
116
-     */
117
-    public function testConstructor_Oauth2NoFlow()
118
-    {
119
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 flow must be either 'implicit', 'password', 'application' or 'accesscode', not ''");
120
-
121
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2');
122
-    }
123
-
124
-    /**
125
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
126
-     */
127
-    public function testConstructor_Oauth2WrongFlow()
128
-    {
129
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 flow must be either 'implicit', 'password', 'application' or 'accesscode', not 'flow'");
130
-
131
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'flow');
132
-    }
133
-
134
-    /**
135
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
136
-     */
137
-    public function testConstructor_Oauth2ImplicitNoUrl()
138
-    {
139
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 authorization URL invalid: ''");
140
-
141
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'implicit');
142
-    }
143
-
144
-    /**
145
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
146
-     */
147
-    public function testConstructor_Oauth2ImplicitBadUrl()
148
-    {
149
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 authorization URL invalid: 'bad'");
150
-
151
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'implicit bad');
152
-    }
153
-
154
-    /**
155
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
156
-     */
157
-    public function testConstructor_Oauth2ImplicitUrl()
158
-    {
159
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'implicit http://www.test');
160
-
161
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
162
-
163
-        $this->assertSame(array(
164
-            'type' => 'oauth2',
165
-            'flow' => 'implicit',
166
-            'authorizationUrl' => 'http://www.test',
167
-        ), $object->toArray());
168
-    }
169
-
170
-    /**
171
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
172
-     */
173
-    public function testConstructor_Oauth2ImplicitUrlDescription()
174
-    {
175
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'implicit http://www.test Some words');
176
-
177
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
178
-
179
-        $this->assertSame(array(
180
-            'type' => 'oauth2',
181
-            'description' => 'Some words',
182
-            'flow' => 'implicit',
183
-            'authorizationUrl' => 'http://www.test',
184
-        ), $object->toArray());
185
-    }
186
-
187
-    /**
188
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
189
-     */
190
-    public function testConstructor_Oauth2PasswordNoUrl()
191
-    {
192
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: ''");
193
-
194
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'password');
195
-    }
196
-
197
-    /**
198
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
199
-     */
200
-    public function testConstructor_Oauth2PasswordBadUrl()
201
-    {
202
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: 'bad'");
203
-
204
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'password bad');
205
-    }
206
-
207
-    /**
208
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
209
-     */
210
-    public function testConstructor_Oauth2Password()
211
-    {
212
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'password http://token.test');
213
-
214
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
215
-
216
-        $this->assertSame(array(
217
-            'type' => 'oauth2',
218
-            'flow' => 'password',
219
-            'tokenUrl' => 'http://token.test',
220
-        ), $object->toArray());
221
-    }
222
-
223
-    /**
224
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
225
-     */
226
-    public function testConstructor_Oauth2PasswordDescription()
227
-    {
228
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'password http://token.test Some words');
229
-
230
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
231
-
232
-        $this->assertSame(array(
233
-            'type' => 'oauth2',
234
-            'description' => 'Some words',
235
-            'flow' => 'password',
236
-            'tokenUrl' => 'http://token.test',
237
-        ), $object->toArray());
238
-    }
239
-
240
-    /**
241
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
242
-     */
243
-    public function testConstructor_Oauth2ApplicationNoUrl()
244
-    {
245
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: ''");
246
-
247
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'application');
248
-    }
249
-
250
-    /**
251
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
252
-     */
253
-    public function testConstructor_Oauth2ApplicationBadUrl()
254
-    {
255
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: 'bad'");
256
-
257
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'application bad');
258
-    }
259
-
260
-    /**
261
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
262
-     */
263
-    public function testConstructor_Oauth2Application()
264
-    {
265
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'application http://token.test');
266
-
267
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
268
-
269
-        $this->assertSame(array(
270
-            'type' => 'oauth2',
271
-            'flow' => 'application',
272
-            'tokenUrl' => 'http://token.test',
273
-        ), $object->toArray());
274
-    }
275
-
276
-    /**
277
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
278
-     */
279
-    public function testConstructor_Oauth2ApplicationDescription()
280
-    {
281
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'application http://token.test Some words');
282
-
283
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
284
-
285
-        $this->assertSame(array(
286
-            'type' => 'oauth2',
287
-            'description' => 'Some words',
288
-            'flow' => 'application',
289
-            'tokenUrl' => 'http://token.test',
290
-        ), $object->toArray());
291
-    }
292
-
293
-    /**
294
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
295
-     */
296
-    public function testConstructor_Oauth2AccesscodeNoUrl1()
297
-    {
298
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 authorization URL invalid: ''");
299
-
300
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode');
301
-    }
302
-
303
-    /**
304
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
305
-     */
306
-    public function testConstructor_Oauth2AccesscodeBadUrl1()
307
-    {
308
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 authorization URL invalid: 'bad'");
309
-
310
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode bad');
311
-    }
312
-
313
-    /**
314
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
315
-     */
316
-    public function testConstructor_Oauth2AccesscodeNoUrl2()
317
-    {
318
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: ''");
319
-
320
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test');
321
-    }
322
-
323
-    /**
324
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
325
-     */
326
-    public function testConstructor_Oauth2AccesscodeBadUrl2()
327
-    {
328
-        $this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: 'bad'");
329
-
330
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test bad');
331
-    }
332
-
333
-    /**
334
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
335
-     */
336
-    public function testConstructor_Oauth2Accesscode()
337
-    {
338
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test');
339
-
340
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
341
-
342
-        $this->assertSame(array(
343
-            'type' => 'oauth2',
344
-            'flow' => 'accessCode',
345
-            'authorizationUrl' => 'http://auth.test',
346
-            'tokenUrl' => 'http://token.test',
347
-        ), $object->toArray());
348
-    }
349
-
350
-    /**
351
-     * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
352
-     */
353
-    public function testConstructor_Oauth2AccesscodeDescription()
354
-    {
355
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode  http://auth.test http://token.test Some words');
356
-
357
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
358
-
359
-        $this->assertSame(array(
360
-            'type' => 'oauth2',
361
-            'description' => 'Some words',
362
-            'flow' => 'accessCode',
363
-            'authorizationUrl' => 'http://auth.test',
364
-            'tokenUrl' => 'http://token.test',
365
-        ), $object->toArray());
366
-    }
367
-
368
-    /**
369
-     * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
370
-     */
371
-    public function testCommandDescription()
372
-    {
373
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test');
374
-
375
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
376
-
377
-        $object->handleCommand('description', 'Some words');
378
-
379
-        $this->assertSame(array(
380
-            'type' => 'oauth2',
381
-            'description' => 'Some words',
382
-            'flow' => 'accessCode',
383
-            'authorizationUrl' => 'http://auth.test',
384
-            'tokenUrl' => 'http://token.test',
385
-        ), $object->toArray());
386
-    }
387
-
388
-    /**
389
-     * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
390
-     */
391
-    public function testCommandDescriptionEmpty()
392
-    {
393
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test Some words');
394
-
395
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
396
-
397
-        $object->handleCommand('description', '');
398
-
399
-        $this->assertSame(array(
400
-            'type' => 'oauth2',
401
-            'flow' => 'accessCode',
402
-            'authorizationUrl' => 'http://auth.test',
403
-            'tokenUrl' => 'http://token.test',
404
-        ), $object->toArray());
405
-    }
406
-
407
-    /**
408
-     * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
409
-     */
410
-    public function testCommandScopeNotOauth()
411
-    {
412
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'basic');
413
-
414
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
415
-
416
-        $this->expectException('\SwaggerGen\Exception', "Cannot set scope on type 'basic'");
417
-
418
-        $object->handleCommand('scope', 'scope1');
419
-    }
420
-
421
-    /**
422
-     * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
423
-     */
424
-    public function testCommandScope()
425
-    {
426
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test');
427
-
428
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
429
-
430
-        $object->handleCommand('scope', 'scope1');
431
-
432
-        $this->assertSame(array(
433
-            'type' => 'oauth2',
434
-            'flow' => 'accessCode',
435
-            'authorizationUrl' => 'http://auth.test',
436
-            'tokenUrl' => 'http://token.test',
437
-            'scopes' => array(
438
-                'scope1' => '',
439
-            )
440
-        ), $object->toArray());
441
-    }
442
-
443
-    /**
444
-     * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
445
-     */
446
-    public function testCommandScopeDescription()
447
-    {
448
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test');
449
-
450
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
451
-
452
-        $object->handleCommand('scope', 'scope1 Some text');
453
-
454
-        $this->assertSame(array(
455
-            'type' => 'oauth2',
456
-            'flow' => 'accessCode',
457
-            'authorizationUrl' => 'http://auth.test',
458
-            'tokenUrl' => 'http://token.test',
459
-            'scopes' => array(
460
-                'scope1' => 'Some text',
461
-            )
462
-        ), $object->toArray());
463
-    }
464
-
465
-    /**
466
-     * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
467
-     */
468
-    public function testCommandScopes()
469
-    {
470
-        $object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test');
471
-
472
-        $this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
473
-
474
-        $object->handleCommand('scope', 'scope2 Some text');
475
-        $object->handleCommand('scope', 'scope1 Some text');
476
-
477
-        $this->assertSame(array(
478
-            'type' => 'oauth2',
479
-            'flow' => 'accessCode',
480
-            'authorizationUrl' => 'http://auth.test',
481
-            'tokenUrl' => 'http://token.test',
482
-            'scopes' => array(
483
-                'scope2' => 'Some text',
484
-                'scope1' => 'Some text',
485
-            )
486
-        ), $object->toArray());
487
-    }
488
-
489
-    protected function setUp(): void
490
-    {
491
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
492
-    }
493
-
494
-    protected function assertPreConditions(): void
495
-    {
496
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
497
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
13
+	 */
14
+	public function testConstructor_UnknownType()
15
+	{
16
+		$this->expectException('\SwaggerGen\Exception', "Security scheme type must be either 'basic', 'apiKey' or 'oauth2', not 'wrong'");
17
+
18
+		new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'wrong');
19
+	}
20
+
21
+	/**
22
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
23
+	 */
24
+	public function testConstructor_Basic()
25
+	{
26
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'basic');
27
+
28
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
29
+
30
+		$this->assertSame(array(
31
+			'type' => 'basic',
32
+		), $object->toArray());
33
+	}
34
+
35
+	/**
36
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
37
+	 */
38
+	public function testConstructor_BasicDescription()
39
+	{
40
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'basic', 'Some text');
41
+
42
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
43
+
44
+		$this->assertSame(array(
45
+			'type' => 'basic',
46
+			'description' => 'Some text',
47
+		), $object->toArray());
48
+	}
49
+
50
+	/**
51
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
52
+	 */
53
+	public function testConstructor_ApiKeyNoName()
54
+	{
55
+		$this->expectException('\SwaggerGen\Exception', "ApiKey in must be either 'query' or 'header', not ''"
56
+		);
57
+
58
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'apikey');
59
+	}
60
+
61
+	/**
62
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
63
+	 */
64
+	public function testConstructor_ApiKeyNoIn()
65
+	{
66
+		$this->expectException('\SwaggerGen\Exception', "ApiKey in must be either 'query' or 'header', not ''");
67
+
68
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'apikey', 'Name');
69
+	}
70
+
71
+	/**
72
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
73
+	 */
74
+	public function testConstructor_ApiKeyWrongIn()
75
+	{
76
+		$this->expectException('\SwaggerGen\Exception', "ApiKey in must be either 'query' or 'header', not 'bad'");
77
+
78
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'apikey', 'Name bad');
79
+	}
80
+
81
+	/**
82
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
83
+	 */
84
+	public function testConstructor_ApiKey()
85
+	{
86
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'apikey', 'Name query');
87
+
88
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
89
+
90
+		$this->assertSame(array(
91
+			'type' => 'apiKey',
92
+			'name' => 'Name',
93
+			'in' => 'query',
94
+		), $object->toArray());
95
+	}
96
+
97
+	/**
98
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
99
+	 */
100
+	public function testConstructor_ApiKeyDescription()
101
+	{
102
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'apikey', 'Name query Some words');
103
+
104
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
105
+
106
+		$this->assertSame(array(
107
+			'type' => 'apiKey',
108
+			'description' => 'Some words',
109
+			'name' => 'Name',
110
+			'in' => 'query',
111
+		), $object->toArray());
112
+	}
113
+
114
+	/**
115
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
116
+	 */
117
+	public function testConstructor_Oauth2NoFlow()
118
+	{
119
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 flow must be either 'implicit', 'password', 'application' or 'accesscode', not ''");
120
+
121
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2');
122
+	}
123
+
124
+	/**
125
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
126
+	 */
127
+	public function testConstructor_Oauth2WrongFlow()
128
+	{
129
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 flow must be either 'implicit', 'password', 'application' or 'accesscode', not 'flow'");
130
+
131
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'flow');
132
+	}
133
+
134
+	/**
135
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
136
+	 */
137
+	public function testConstructor_Oauth2ImplicitNoUrl()
138
+	{
139
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 authorization URL invalid: ''");
140
+
141
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'implicit');
142
+	}
143
+
144
+	/**
145
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
146
+	 */
147
+	public function testConstructor_Oauth2ImplicitBadUrl()
148
+	{
149
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 authorization URL invalid: 'bad'");
150
+
151
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'implicit bad');
152
+	}
153
+
154
+	/**
155
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
156
+	 */
157
+	public function testConstructor_Oauth2ImplicitUrl()
158
+	{
159
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'implicit http://www.test');
160
+
161
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
162
+
163
+		$this->assertSame(array(
164
+			'type' => 'oauth2',
165
+			'flow' => 'implicit',
166
+			'authorizationUrl' => 'http://www.test',
167
+		), $object->toArray());
168
+	}
169
+
170
+	/**
171
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
172
+	 */
173
+	public function testConstructor_Oauth2ImplicitUrlDescription()
174
+	{
175
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'implicit http://www.test Some words');
176
+
177
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
178
+
179
+		$this->assertSame(array(
180
+			'type' => 'oauth2',
181
+			'description' => 'Some words',
182
+			'flow' => 'implicit',
183
+			'authorizationUrl' => 'http://www.test',
184
+		), $object->toArray());
185
+	}
186
+
187
+	/**
188
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
189
+	 */
190
+	public function testConstructor_Oauth2PasswordNoUrl()
191
+	{
192
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: ''");
193
+
194
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'password');
195
+	}
196
+
197
+	/**
198
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
199
+	 */
200
+	public function testConstructor_Oauth2PasswordBadUrl()
201
+	{
202
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: 'bad'");
203
+
204
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'password bad');
205
+	}
206
+
207
+	/**
208
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
209
+	 */
210
+	public function testConstructor_Oauth2Password()
211
+	{
212
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'password http://token.test');
213
+
214
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
215
+
216
+		$this->assertSame(array(
217
+			'type' => 'oauth2',
218
+			'flow' => 'password',
219
+			'tokenUrl' => 'http://token.test',
220
+		), $object->toArray());
221
+	}
222
+
223
+	/**
224
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
225
+	 */
226
+	public function testConstructor_Oauth2PasswordDescription()
227
+	{
228
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'password http://token.test Some words');
229
+
230
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
231
+
232
+		$this->assertSame(array(
233
+			'type' => 'oauth2',
234
+			'description' => 'Some words',
235
+			'flow' => 'password',
236
+			'tokenUrl' => 'http://token.test',
237
+		), $object->toArray());
238
+	}
239
+
240
+	/**
241
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
242
+	 */
243
+	public function testConstructor_Oauth2ApplicationNoUrl()
244
+	{
245
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: ''");
246
+
247
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'application');
248
+	}
249
+
250
+	/**
251
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
252
+	 */
253
+	public function testConstructor_Oauth2ApplicationBadUrl()
254
+	{
255
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: 'bad'");
256
+
257
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'application bad');
258
+	}
259
+
260
+	/**
261
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
262
+	 */
263
+	public function testConstructor_Oauth2Application()
264
+	{
265
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'application http://token.test');
266
+
267
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
268
+
269
+		$this->assertSame(array(
270
+			'type' => 'oauth2',
271
+			'flow' => 'application',
272
+			'tokenUrl' => 'http://token.test',
273
+		), $object->toArray());
274
+	}
275
+
276
+	/**
277
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
278
+	 */
279
+	public function testConstructor_Oauth2ApplicationDescription()
280
+	{
281
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'application http://token.test Some words');
282
+
283
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
284
+
285
+		$this->assertSame(array(
286
+			'type' => 'oauth2',
287
+			'description' => 'Some words',
288
+			'flow' => 'application',
289
+			'tokenUrl' => 'http://token.test',
290
+		), $object->toArray());
291
+	}
292
+
293
+	/**
294
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
295
+	 */
296
+	public function testConstructor_Oauth2AccesscodeNoUrl1()
297
+	{
298
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 authorization URL invalid: ''");
299
+
300
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode');
301
+	}
302
+
303
+	/**
304
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
305
+	 */
306
+	public function testConstructor_Oauth2AccesscodeBadUrl1()
307
+	{
308
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 authorization URL invalid: 'bad'");
309
+
310
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode bad');
311
+	}
312
+
313
+	/**
314
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
315
+	 */
316
+	public function testConstructor_Oauth2AccesscodeNoUrl2()
317
+	{
318
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: ''");
319
+
320
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test');
321
+	}
322
+
323
+	/**
324
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
325
+	 */
326
+	public function testConstructor_Oauth2AccesscodeBadUrl2()
327
+	{
328
+		$this->expectException('\SwaggerGen\Exception', "OAuth2 token URL invalid: 'bad'");
329
+
330
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test bad');
331
+	}
332
+
333
+	/**
334
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
335
+	 */
336
+	public function testConstructor_Oauth2Accesscode()
337
+	{
338
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test');
339
+
340
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
341
+
342
+		$this->assertSame(array(
343
+			'type' => 'oauth2',
344
+			'flow' => 'accessCode',
345
+			'authorizationUrl' => 'http://auth.test',
346
+			'tokenUrl' => 'http://token.test',
347
+		), $object->toArray());
348
+	}
349
+
350
+	/**
351
+	 * @covers \SwaggerGen\Swagger\SecurityScheme::__construct
352
+	 */
353
+	public function testConstructor_Oauth2AccesscodeDescription()
354
+	{
355
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode  http://auth.test http://token.test Some words');
356
+
357
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
358
+
359
+		$this->assertSame(array(
360
+			'type' => 'oauth2',
361
+			'description' => 'Some words',
362
+			'flow' => 'accessCode',
363
+			'authorizationUrl' => 'http://auth.test',
364
+			'tokenUrl' => 'http://token.test',
365
+		), $object->toArray());
366
+	}
367
+
368
+	/**
369
+	 * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
370
+	 */
371
+	public function testCommandDescription()
372
+	{
373
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test');
374
+
375
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
376
+
377
+		$object->handleCommand('description', 'Some words');
378
+
379
+		$this->assertSame(array(
380
+			'type' => 'oauth2',
381
+			'description' => 'Some words',
382
+			'flow' => 'accessCode',
383
+			'authorizationUrl' => 'http://auth.test',
384
+			'tokenUrl' => 'http://token.test',
385
+		), $object->toArray());
386
+	}
387
+
388
+	/**
389
+	 * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
390
+	 */
391
+	public function testCommandDescriptionEmpty()
392
+	{
393
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test Some words');
394
+
395
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
396
+
397
+		$object->handleCommand('description', '');
398
+
399
+		$this->assertSame(array(
400
+			'type' => 'oauth2',
401
+			'flow' => 'accessCode',
402
+			'authorizationUrl' => 'http://auth.test',
403
+			'tokenUrl' => 'http://token.test',
404
+		), $object->toArray());
405
+	}
406
+
407
+	/**
408
+	 * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
409
+	 */
410
+	public function testCommandScopeNotOauth()
411
+	{
412
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'basic');
413
+
414
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
415
+
416
+		$this->expectException('\SwaggerGen\Exception', "Cannot set scope on type 'basic'");
417
+
418
+		$object->handleCommand('scope', 'scope1');
419
+	}
420
+
421
+	/**
422
+	 * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
423
+	 */
424
+	public function testCommandScope()
425
+	{
426
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test');
427
+
428
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
429
+
430
+		$object->handleCommand('scope', 'scope1');
431
+
432
+		$this->assertSame(array(
433
+			'type' => 'oauth2',
434
+			'flow' => 'accessCode',
435
+			'authorizationUrl' => 'http://auth.test',
436
+			'tokenUrl' => 'http://token.test',
437
+			'scopes' => array(
438
+				'scope1' => '',
439
+			)
440
+		), $object->toArray());
441
+	}
442
+
443
+	/**
444
+	 * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
445
+	 */
446
+	public function testCommandScopeDescription()
447
+	{
448
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test');
449
+
450
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
451
+
452
+		$object->handleCommand('scope', 'scope1 Some text');
453
+
454
+		$this->assertSame(array(
455
+			'type' => 'oauth2',
456
+			'flow' => 'accessCode',
457
+			'authorizationUrl' => 'http://auth.test',
458
+			'tokenUrl' => 'http://token.test',
459
+			'scopes' => array(
460
+				'scope1' => 'Some text',
461
+			)
462
+		), $object->toArray());
463
+	}
464
+
465
+	/**
466
+	 * @covers \SwaggerGen\Swagger\SecurityScheme->handleCommand
467
+	 */
468
+	public function testCommandScopes()
469
+	{
470
+		$object = new \SwaggerGen\Swagger\SecurityScheme($this->parent, 'oauth2', 'accesscode http://auth.test http://token.test');
471
+
472
+		$this->assertInstanceOf('\SwaggerGen\Swagger\SecurityScheme', $object);
473
+
474
+		$object->handleCommand('scope', 'scope2 Some text');
475
+		$object->handleCommand('scope', 'scope1 Some text');
476
+
477
+		$this->assertSame(array(
478
+			'type' => 'oauth2',
479
+			'flow' => 'accessCode',
480
+			'authorizationUrl' => 'http://auth.test',
481
+			'tokenUrl' => 'http://token.test',
482
+			'scopes' => array(
483
+				'scope2' => 'Some text',
484
+				'scope1' => 'Some text',
485
+			)
486
+		), $object->toArray());
487
+	}
488
+
489
+	protected function setUp(): void
490
+	{
491
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
492
+	}
493
+
494
+	protected function assertPreConditions(): void
495
+	{
496
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
497
+	}
498 498
 
499 499
 }
Please login to merge, or discard this patch.
tests/Swagger/AbstractDocumentableObjectTest.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -6,65 +6,65 @@
 block discarded – undo
6 6
 class AbstractDocumentableObjectTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Tag::__construct
13
-     * @covers \SwaggerGen\Swagger\AbstractDocumentableObject->handleCommand
14
-     */
15
-    public function testCommandDocWithoutDescription()
16
-    {
17
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
18
-
19
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
20
-
21
-        $this->assertSame(array(
22
-            'name' => 'Name',
23
-        ), $object->toArray());
24
-
25
-        $object->handleCommand('doc', 'http://example.test');
26
-
27
-        $this->assertSame(array(
28
-            'name' => 'Name',
29
-            'externalDocs' => array(
30
-                'url' => 'http://example.test',
31
-            ),
32
-        ), $object->toArray());
33
-    }
34
-
35
-    /**
36
-     * @covers \SwaggerGen\Swagger\Tag::__construct
37
-     * @covers \SwaggerGen\Swagger\AbstractDocumentableObject->handleCommand
38
-     */
39
-    public function testCommandDocWithDescription()
40
-    {
41
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
42
-
43
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
44
-
45
-        $this->assertSame(array(
46
-            'name' => 'Name',
47
-        ), $object->toArray());
48
-
49
-        $object->handleCommand('doc', 'http://example.test Some words here');
50
-
51
-        $this->assertSame(array(
52
-            'name' => 'Name',
53
-            'externalDocs' => array(
54
-                'url' => 'http://example.test',
55
-                'description' => 'Some words here',
56
-            ),
57
-        ), $object->toArray());
58
-    }
59
-
60
-    protected function setUp(): void
61
-    {
62
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
63
-    }
64
-
65
-    protected function assertPreConditions(): void
66
-    {
67
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
68
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Tag::__construct
13
+	 * @covers \SwaggerGen\Swagger\AbstractDocumentableObject->handleCommand
14
+	 */
15
+	public function testCommandDocWithoutDescription()
16
+	{
17
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
18
+
19
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
20
+
21
+		$this->assertSame(array(
22
+			'name' => 'Name',
23
+		), $object->toArray());
24
+
25
+		$object->handleCommand('doc', 'http://example.test');
26
+
27
+		$this->assertSame(array(
28
+			'name' => 'Name',
29
+			'externalDocs' => array(
30
+				'url' => 'http://example.test',
31
+			),
32
+		), $object->toArray());
33
+	}
34
+
35
+	/**
36
+	 * @covers \SwaggerGen\Swagger\Tag::__construct
37
+	 * @covers \SwaggerGen\Swagger\AbstractDocumentableObject->handleCommand
38
+	 */
39
+	public function testCommandDocWithDescription()
40
+	{
41
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
42
+
43
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
44
+
45
+		$this->assertSame(array(
46
+			'name' => 'Name',
47
+		), $object->toArray());
48
+
49
+		$object->handleCommand('doc', 'http://example.test Some words here');
50
+
51
+		$this->assertSame(array(
52
+			'name' => 'Name',
53
+			'externalDocs' => array(
54
+				'url' => 'http://example.test',
55
+				'description' => 'Some words here',
56
+			),
57
+		), $object->toArray());
58
+	}
59
+
60
+	protected function setUp(): void
61
+	{
62
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
63
+	}
64
+
65
+	protected function assertPreConditions(): void
66
+	{
67
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
68
+	}
69 69
 
70 70
 }
Please login to merge, or discard this patch.