QueryFormatterTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testFormat() 0 8 1
A provideTestFormat() 0 7 1
1
<?php
2
3
namespace Asparagus\Tests\Integration;
4
5
use Asparagus\QueryFormatter;
6
7
/**
8
 * @license GNU GPL v2+
9
 * @author Bene* < [email protected] >
10
 */
11
class QueryFormatterTest extends \PHPUnit_Framework_TestCase {
12
13
	/**
14
	 * @dataProvider provideTestFormat
15
	 */
16
	public function testFormat( $name ) {
17
		$formatter = new QueryFormatter();
18
		$sparql = file_get_contents( __DIR__ . '/../data/formatter_' . $name . '_in.rq' );
19
		$expected = file_get_contents( __DIR__ . '/../data/formatter_' . $name . '_out.rq' );
20
21
		$this->assertEquals( $expected, $formatter->format( $sparql ),
22
			'Input from formatter_' . $name . '_in.rq didn\'t produce the expected output.'  );
23
	}
24
25
	public function provideTestFormat() {
26
		return array(
27
			'Query without line-breaks' => array( 'one_line' ),
28
			'Query with lots of spaces' => array( 'many_spaces' ),
29
			'Query with few spaces' => array( 'few_spaces' )
30
		);
31
	}
32
33
}
34