PeachyAWBFunctionsTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
B provideFixDateTags() 0 33 1
A testFixDateTags() 0 5 2
1
<?php
2
3
namespace Tests;
4
5
use PeachyAWBFunctions;
6
7
class PeachyAWBFunctionsTest extends \PHPUnit_Framework_TestCase {
8
9
	public function provideFixDateTags() {
10
		//@todo add tests for more cases
11
		return array(
12
			array(
13
				'{{Wikify|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}',
14
				array(
15
					'{{wfy}}',
16
					'{{wikify}}',
17
					'{{Template:Wikify}}',
18
					'{{Template:Wikify-date}}',
19
					'{{wiki}}',
20
					'{{wiki    }}',
21
				)
22
			),
23
			array(
24
				'{{Wikify|section|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}',
25
				array(
26
					'{{wfy|section}}',
27
					'{{wikify|section}}',
28
					'{{Template:Wikify|section}}',
29
				)
30
			),
31
			array(
32
				'{{Cleanup|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}',
33
				array(
34
					'{{cleanup}}',
35
					'{{template:cleanup}}',
36
					'{{cu}}',
37
					'{{tidy}}',
38
				),
39
			)
40
		);
41
	}
42
43
	/**
44
	 * @dataProvider provideFixDateTags
45
	 * @covers       PeachyAWBFunctions::fixDateTags
46
	 */
47
	public function testFixDateTags( $expected, $inputTextArray ) {
48
		foreach( $inputTextArray as $text ){
49
			$this->assertEquals( $expected, PeachyAWBFunctions::fixDateTags( $text ) );
50
		}
51
	}
52
53
}