Completed
Push — master ( 088bf6...a47832 )
by Martijn
02:41
created

OutputTest::provideAllCases()   B

Complexity

Conditions 4
Paths 5

Size

Total Lines 24
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 15
nc 5
nop 0
dl 0
loc 24
rs 8.6845
c 0
b 0
f 0
1
<?php
2
3
class OutputTest extends SwaggerGen_TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
6
	/**
7
	 * @covers \SwaggerGen\Exception::__construct
8
	 * @dataProvider provideAllCases
9
	 */
10
	public function testAllCases($name, $files, $expected)
11
	{
12
		$SwaggerGen = new \SwaggerGen\SwaggerGen('example.com', '/base');
13
		$actual = $SwaggerGen->getSwagger($files, array(), \SwaggerGen\SwaggerGen::FORMAT_JSON);
14
		$this->assertSame($expected, $actual, $name);
15
	}
16
	
17
	public function provideAllCases() {
18
		$cases = array();
19
		
20
		foreach (glob(__DIR__ . '/*', GLOB_ONLYDIR) as $dir) {					
21
			$path = realpath($dir);					
22
			$json = json_encode(json_decode(file_get_contents($path . '/expected.json')));
23
			
24
			$files = array();
25
			if (file_exists($path . '/source.php')) {
26
				$files[] = $path . '/source.php';
27
			}
28
			if (file_exists($path . '/source.txt')) {
29
				$files[] = $path . '/source.txt';
30
			}
31
			
32
			$cases[] = array(
33
				basename($dir),
34
				$files,
35
				$json
36
			);
37
		}
38
		
39
		return $cases;
40
	}
41
42
}
43